np.fromfile not supported
CONTRIBUTOR
@lhoestq
Can you provide me with some ideas？
2024-01-12T09:55:37Z
https://github.com/huggingface/datasets/issues/6584#issuecomment-1888780092
https://api.github.com/repos/huggingface/datasets/issues/6584
IC_kwDODunzps5wlH88
https://api.github.com/repos/huggingface/datasets/issues/comments/1888780092/reactions
2024-01-12T09:55:37Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1888780092
https://avatars.githubusercontent.com/u/12895488?v=4
https://api.github.com/users/d710055071/events{/privacy}
https://api.github.com/users/d710055071/followers
https://api.github.com/users/d710055071/following{/other_user}
https://api.github.com/users/d710055071/gists{/gist_id}
https://github.com/d710055071
d710055071
MDQ6VXNlcjEyODk1NDg4
https://api.github.com/users/d710055071/orgs
https://api.github.com/users/d710055071/received_events
https://api.github.com/users/d710055071/repos
https://api.github.com/users/d710055071/starred{/owner}{/repo}
https://api.github.com/users/d710055071/subscriptions
User
https://api.github.com/users/d710055071
public
MEMBER
Hi ! What's the error ?
2024-01-12T13:40:53Z
https://github.com/huggingface/datasets/issues/6584#issuecomment-1889237437
https://api.github.com/repos/huggingface/datasets/issues/6584
IC_kwDODunzps5wm3m9
https://api.github.com/repos/huggingface/datasets/issues/comments/1889237437/reactions
2024-01-12T13:40:53Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1889237437
https://avatars.githubusercontent.com/u/42851186?v=4
https://api.github.com/users/lhoestq/events{/privacy}
https://api.github.com/users/lhoestq/followers
https://api.github.com/users/lhoestq/following{/other_user}
https://api.github.com/users/lhoestq/gists{/gist_id}
https://github.com/lhoestq
lhoestq
MDQ6VXNlcjQyODUxMTg2
https://api.github.com/users/lhoestq/orgs
https://api.github.com/users/lhoestq/received_events
https://api.github.com/users/lhoestq/repos
https://api.github.com/users/lhoestq/starred{/owner}{/repo}
https://api.github.com/users/lhoestq/subscriptions
User
https://api.github.com/users/lhoestq
public
CONTRIBUTOR
@lhoestq 
```
Traceback (most recent call last):
  File "/home/dongzf/miniconda3/envs/dataset_ai/lib/python3.11/runpy.py", line 198, in _run_module_as_main
    return _run_code(code, main_globals, None,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dongzf/miniconda3/envs/dataset_ai/lib/python3.11/runpy.py", line 88, in _run_code
    exec(code, run_globals)
  File "/home/dongzf/.vscode/extensions/ms-python.python-2023.22.1/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py", line 39, in <module>
    cli.main()
  File "/home/dongzf/.vscode/extensions/ms-python.python-2023.22.1/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main
    run()
  File "/home/dongzf/.vscode/extensions/ms-python.python-2023.22.1/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 284, in run_file
    runpy.run_path(target, run_name="__main__")
  File "/home/dongzf/.vscode/extensions/ms-python.python-2023.22.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 321, in run_path
    return _run_module_code(code, init_globals, run_name,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dongzf/.vscode/extensions/ms-python.python-2023.22.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 135, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/home/dongzf/.vscode/extensions/ms-python.python-2023.22.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code
    exec(code, run_globals)
  File "/mnt/sda/code/dataset_ai/dataset_ai/example/test.py", line 83, in <module>
    data = xnumpy_fromfile(current_dir, download_config=config,dtype=numpy.float32,)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/sda/code/dataset_ai/dataset_ai/src/datasets/download/streaming_download_manager.py", line 765, in xnumpy_fromfile
    return np.fromfile(xopen(filepath_or_buffer, "rb", download_config=download_config).read(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: embedded null byte
```
2024-01-15T00:07:19Z
https://github.com/huggingface/datasets/issues/6584#issuecomment-1891121798
https://api.github.com/repos/huggingface/datasets/issues/6584
IC_kwDODunzps5wuDqG
https://api.github.com/repos/huggingface/datasets/issues/comments/1891121798/reactions
2024-01-15T00:14:27Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1891121798
https://avatars.githubusercontent.com/u/12895488?v=4
https://api.github.com/users/d710055071/events{/privacy}
https://api.github.com/users/d710055071/followers
https://api.github.com/users/d710055071/following{/other_user}
https://api.github.com/users/d710055071/gists{/gist_id}
https://github.com/d710055071
d710055071
MDQ6VXNlcjEyODk1NDg4
https://api.github.com/users/d710055071/orgs
https://api.github.com/users/d710055071/received_events
https://api.github.com/users/d710055071/repos
https://api.github.com/users/d710055071/starred{/owner}{/repo}
https://api.github.com/users/d710055071/subscriptions
User
https://api.github.com/users/d710055071
public
CONTRIBUTOR
    not add read() 
the error is 

return np.fromfile(xopen(filepath_or_buffer, "rb", download_config=download_config), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
io.UnsupportedOperation: fileno
2024-01-15T02:08:25Z
https://github.com/huggingface/datasets/issues/6584#issuecomment-1891193518
https://api.github.com/repos/huggingface/datasets/issues/6584
IC_kwDODunzps5wuVKu
https://api.github.com/repos/huggingface/datasets/issues/comments/1891193518/reactions
2024-01-15T02:08:25Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1891193518
https://avatars.githubusercontent.com/u/12895488?v=4
https://api.github.com/users/d710055071/events{/privacy}
https://api.github.com/users/d710055071/followers
https://api.github.com/users/d710055071/following{/other_user}
https://api.github.com/users/d710055071/gists{/gist_id}
https://github.com/d710055071
d710055071
MDQ6VXNlcjEyODk1NDg4
https://api.github.com/users/d710055071/orgs
https://api.github.com/users/d710055071/received_events
https://api.github.com/users/d710055071/repos
https://api.github.com/users/d710055071/starred{/owner}{/repo}
https://api.github.com/users/d710055071/subscriptions
User
https://api.github.com/users/d710055071
public
CONTRIBUTOR
xopen return obj do not have fileno function
I don't know why?
2024-01-15T03:02:31Z
https://github.com/huggingface/datasets/issues/6584#issuecomment-1891230435
https://api.github.com/repos/huggingface/datasets/issues/6584
IC_kwDODunzps5wueLj
https://api.github.com/repos/huggingface/datasets/issues/comments/1891230435/reactions
2024-01-15T03:02:31Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1891230435
https://avatars.githubusercontent.com/u/12895488?v=4
https://api.github.com/users/d710055071/events{/privacy}
https://api.github.com/users/d710055071/followers
https://api.github.com/users/d710055071/following{/other_user}
https://api.github.com/users/d710055071/gists{/gist_id}
https://github.com/d710055071
d710055071
MDQ6VXNlcjEyODk1NDg4
https://api.github.com/users/d710055071/orgs
https://api.github.com/users/d710055071/received_events
https://api.github.com/users/d710055071/repos
https://api.github.com/users/d710055071/starred{/owner}{/repo}
https://api.github.com/users/d710055071/subscriptions
User
https://api.github.com/users/d710055071
public
CONTRIBUTOR
I used this method to read point cloud data in the script


```python
with open(velodyne_filepath,"rb") as obj:
    velodyne_data = numpy.frombuffer(obj.read(), dtype=numpy.float32).reshape([-1, 4])
```
2024-01-15T05:20:49Z
https://github.com/huggingface/datasets/issues/6584#issuecomment-1891319858
https://api.github.com/repos/huggingface/datasets/issues/6584
IC_kwDODunzps5wu0Ay
https://api.github.com/repos/huggingface/datasets/issues/comments/1891319858/reactions
2024-01-15T05:20:49Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1891319858
https://avatars.githubusercontent.com/u/12895488?v=4
https://api.github.com/users/d710055071/events{/privacy}
https://api.github.com/users/d710055071/followers
https://api.github.com/users/d710055071/following{/other_user}
https://api.github.com/users/d710055071/gists{/gist_id}
https://github.com/d710055071
d710055071
MDQ6VXNlcjEyODk1NDg4
https://api.github.com/users/d710055071/orgs
https://api.github.com/users/d710055071/received_events
https://api.github.com/users/d710055071/repos
https://api.github.com/users/d710055071/starred{/owner}{/repo}
https://api.github.com/users/d710055071/subscriptions
User
https://api.github.com/users/d710055071
public
How to do np.fromfile  to use it like np.load


```python
def xnumpy_fromfile(filepath_or_buffer, *args, download_config: Optional[DownloadConfig] = None, **kwargs):
    import numpy as np

    if hasattr(filepath_or_buffer, "read"):
        return np.fromfile(filepath_or_buffer, *args, **kwargs)
    else:
        filepath_or_buffer = str(filepath_or_buffer)
        return np.fromfile(xopen(filepath_or_buffer, "rb", download_config=download_config).read(), *args, **kwargs)
```
this is not work
