Fix torchaudio.load() Path compatibility issue#97
Open
Mr-Neutr0n wants to merge 1 commit intofacebookresearch:mainfrom
Open
Fix torchaudio.load() Path compatibility issue#97Mr-Neutr0n wants to merge 1 commit intofacebookresearch:mainfrom
Mr-Neutr0n wants to merge 1 commit intofacebookresearch:mainfrom
Conversation
Convert Path object to string before passing to torchaudio.load() to fix compatibility with torchaudio backends that expect string paths. Fixes RuntimeError: "Expected a value of type 'str' for argument '0' but instead found type 'PosixPath'" Fixes facebookresearch#92
Author
|
hey, just checking in on this one. it fixes a Path compatibility issue with torchaudio.load(). pretty small change, happy to adjust anything |
Author
|
Friendly bump! Let me know if there's anything I should update or improve to help move this forward. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Pathobject to string before passing totorchaudio.load()for backend compatibilityProblem
When running the encodec CLI:
The command fails with:
This occurs because
args.inputis apathlib.Pathobject, but some torchaudio backends (like sox) require a string path.Solution
Convert the Path to string using
str(args.input)before passing totorchaudio.load().This is consistent with how
save_audio()inutils.pyalready handles path conversion.Test plan
encodec -b 6.0 input.wav output.ecdcon a test audio fileFixes #92