Repository navigation
fix(transcribe): accept a Hugging Face model id in EASYEDIT_WHISPER - #77
Merged
Merged
Conversation
Owner
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.
What does this change?
Fixes #71.
cache_for()put the rawEASYEDIT_WHISPERvalue into the transcript cache file name, so a Hugging Face id such asSystran/faster-whisper-smallraisedValueError: Invalid name 'words-abc-en-Systran/faster-whisper-small.json'before transcription started.The model part of the name now has every character outside
[A-Za-z0-9._-]replaced with_, as the issue suggests, givingwords-abc-en-Systran_faster-whisper-small.json. Plain names such asdistil-large-v3keep their current cache name, andtranscribe()still passes the raw value to faster-whisper.A value that already worked but holds other characters (a Windows path on macOS or Linux, a name with a space) gets a new cache name, so that job transcribes once more and picks its quote again, replacing
quote.json.How did you test it?
python -m unittest discoverpasses: 87 tests on macOS, Python 3.12.16 (86 on main).python -m easyedit.doctorreportsready(CPU only).The new test in
tests/test_transcribe_cache.pychecks thatSystran/faster-whisper-small,C:\models\smalland/models/smallstay in the cache folder with a file-safe name, and thatdistil-large-v3keeps its name. On main it errors with the sameInvalid nameerror. I also calledcache_for()with each value before and after the change. On macOS I checked the Windows path withPureWindowsPath, which rejects the name main builds for it with the sameValueError; I did not run it on Windows.Checklist
easyedit/util.pyhelpers: not applicable, no subprocess callsjobs/,.cache/,node_modules/, or any footageEASYEDIT_WHISPERa faster-whisper model name, which covers Hugging Face ids and foldersOS tested: macOS.