- 
                Notifications
    You must be signed in to change notification settings 
- Fork 736
Support file-like object in load function #1158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
73db470    to
    fc9b189      
    Compare
  
    | Thank you, this is an awesome and much needed feature. Your work is appreciated! | 
| 
 Hi @rbracco Thanks :) . Please try it out and give feedback. | 
| I have tried it out by sending audio from a React-based frontend to a fastapi backend that receives a file-like object as an upload and then reads it into torchaudio. It worked great with wav files, but when I tried to simplify by moving to mp3 (smaller, more efficient) I started getting  All of the following work: For this reason I think it is likely an issue with the new file-like object loading, but unfortunately I have very shallow knowledge of audio formats, C++, and how this works under the hood. I'm happy to keep helping with testing though, please let me know if you have any ideas for a fix, or if this is worthy of a separate issue. Thanks again, I'm really excited for this feature and I'm in an audio ML chat on telegram with many others who feel the same.  | 
| Hi @rbracco Thanks for trying out and the feedback. I am happy to hear that this addition is helpful for you. For your issue, 
 If you still see an issue, please open an issue. I am more than happy to look at it. | 
Ever since the file-like object support was added in pytorch#1158, the test was occasionally failing in CI. This PR fixes this.
Ever since the file-like object support was added in pytorch#1158, the test was occasionally failing in CI. This PR fixes this.
* Fix fileobj I/O undeterministic behavior Ever since the file-like object support was added in #1158, the test was occasionally failing in CI. This PR fixes this.
* Fix fileobj I/O undeterministic behavior Ever since the file-like object support was added in pytorch#1158, the test was occasionally failing in CI. This PR fixes this.
* Create distributed_rpc_profiling.rst * Update recipes_index.rst * Add files via upload * Update recipes_index.rst
This PR adds file-like object support to load function.
stdinWith
requestsboto3For
sox_iobackend, the new loading functionload_audio_fileobj, which works on any Python object withreadmethod that returnsbytes. It is added and bound via PyBind11.For
soundfilebackend,pysoundfilenatively supports file-like objectcloses #754 #800
See als #1115