-
Notifications
You must be signed in to change notification settings - Fork 27.8k
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
[Wav2Vec2] PyCTCDecode Integration to support language model boosted decoding #14339
Merged
patrickvonplaten
merged 34 commits into
huggingface:master
from
patrickvonplaten:pyctcdecode_integration
Dec 8, 2021
Merged
Changes from 29 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
6de1445
up
patrickvonplaten b68faa9
up
patrickvonplaten 8294efa
up
patrickvonplaten 6ec01c2
make it cleaner
patrickvonplaten 52afd82
correct
patrickvonplaten e3b0fde
make styhahalal
patrickvonplaten e7eb51c
add more tests
patrickvonplaten ff0de09
finish
patrickvonplaten 6296938
small fix
patrickvonplaten 84bfdf3
make style
patrickvonplaten 4caf406
up
patrickvonplaten d59b594
tryout to solve cicrle ci
patrickvonplaten ead3873
Merge branch 'master' into pyctcdecode_integration
patrickvonplaten 682b258
up
patrickvonplaten 6320a5a
Merge branch 'pyctcdecode_integration' of https://github.com/patrickv…
patrickvonplaten 53aaeff
fix more tests
patrickvonplaten 7b24cdc
fix more tests
patrickvonplaten f3648f6
apply sylvains suggestions
patrickvonplaten f39f02c
fix import
patrickvonplaten 19a1301
correct docs
patrickvonplaten 88783e3
add pyctcdecode only to speech tests
patrickvonplaten 51f3dc7
fix more tests
patrickvonplaten ceb6ea2
add tf, flax and pt tests
patrickvonplaten e2b19af
add pt
patrickvonplaten b1ba5dd
fix last tests
patrickvonplaten a52f319
fix more tests
patrickvonplaten 66dd6d8
Apply suggestions from code review
patrickvonplaten d9cdb5e
change lines
patrickvonplaten b93b954
Merge branch 'pyctcdecode_integration' of https://github.com/patrickv…
patrickvonplaten 0fe15e1
Apply suggestions from code review
patrickvonplaten 2382b92
correct tests
patrickvonplaten 8e70208
Merge branch 'pyctcdecode_integration' of https://github.com/patrickv…
patrickvonplaten b46df6b
correct tests
patrickvonplaten 776d152
add doc string
patrickvonplaten File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,6 +83,7 @@ jobs: | |
- run: pip install .[sklearn,tf-cpu,torch,testing,sentencepiece,torch-speech,vision] | ||
- run: pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.10.0+cpu.html | ||
- run: pip install tensorflow_probability | ||
- run: pip install https://github.com/kpu/kenlm/archive/master.zip | ||
- save_cache: | ||
key: v0.4-{{ checksum "setup.py" }} | ||
paths: | ||
|
@@ -151,6 +152,7 @@ jobs: | |
- run: pip install --upgrade pip | ||
- run: pip install .[sklearn,flax,torch,testing,sentencepiece,torch-speech,vision] | ||
- run: pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.10.0+cpu.html | ||
- run: pip install https://github.com/kpu/kenlm/archive/master.zip | ||
- save_cache: | ||
key: v0.4-{{ checksum "setup.py" }} | ||
paths: | ||
|
@@ -187,6 +189,7 @@ jobs: | |
- run: pip install --upgrade pip | ||
- run: pip install .[sklearn,flax,torch,testing,sentencepiece,torch-speech,vision] | ||
- run: pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.10.0+cpu.html | ||
- run: pip install https://github.com/kpu/kenlm/archive/master.zip | ||
- save_cache: | ||
key: v0.4-{{ checksum "setup.py" }} | ||
paths: | ||
|
@@ -217,6 +220,7 @@ jobs: | |
- run: pip install --upgrade pip | ||
- run: pip install .[sklearn,torch,testing,sentencepiece,torch-speech,vision,timm] | ||
- run: pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.10.0+cpu.html | ||
- run: pip install https://github.com/kpu/kenlm/archive/master.zip | ||
- save_cache: | ||
key: v0.4-torch-{{ checksum "setup.py" }} | ||
paths: | ||
|
@@ -252,6 +256,7 @@ jobs: | |
- run: pip install --upgrade pip | ||
- run: pip install .[sklearn,torch,testing,sentencepiece,torch-speech,vision,timm] | ||
- run: pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.10.0+cpu.html | ||
- run: pip install https://github.com/kpu/kenlm/archive/master.zip | ||
- save_cache: | ||
key: v0.4-torch-{{ checksum "setup.py" }} | ||
paths: | ||
|
@@ -281,6 +286,7 @@ jobs: | |
- run: pip install --upgrade pip | ||
- run: pip install .[sklearn,tf-cpu,testing,sentencepiece,tf-speech,vision] | ||
- run: pip install tensorflow_probability | ||
- run: pip install https://github.com/kpu/kenlm/archive/master.zip | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need it in the TF tests? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a |
||
- save_cache: | ||
key: v0.4-tf-{{ checksum "setup.py" }} | ||
paths: | ||
|
@@ -313,8 +319,10 @@ jobs: | |
- v0.4-tf-{{ checksum "setup.py" }} | ||
- v0.4-{{ checksum "setup.py" }} | ||
- run: pip install --upgrade pip | ||
- run: sudo apt-get -y update && sudo apt-get install -y libsndfile1-dev | ||
- run: pip install .[sklearn,tf-cpu,testing,sentencepiece,tf-speech,vision] | ||
- run: pip install tensorflow_probability | ||
- run: pip install https://github.com/kpu/kenlm/archive/master.zip | ||
- save_cache: | ||
key: v0.4-tf-{{ checksum "setup.py" }} | ||
paths: | ||
|
@@ -342,7 +350,8 @@ jobs: | |
- v0.4-flax-{{ checksum "setup.py" }} | ||
- v0.4-{{ checksum "setup.py" }} | ||
- run: pip install --upgrade pip | ||
- run: sudo pip install .[flax,testing,sentencepiece,flax-speech,vision] | ||
- run: pip install .[flax,testing,sentencepiece,flax-speech,vision] | ||
- run: pip install https://github.com/kpu/kenlm/archive/master.zip | ||
patrickvonplaten marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- save_cache: | ||
key: v0.4-flax-{{ checksum "setup.py" }} | ||
paths: | ||
|
@@ -375,7 +384,9 @@ jobs: | |
- v0.4-flax-{{ checksum "setup.py" }} | ||
- v0.4-{{ checksum "setup.py" }} | ||
- run: pip install --upgrade pip | ||
- run: sudo pip install .[flax,testing,sentencepiece,vision,flax-speech] | ||
- run: sudo apt-get -y update && sudo apt-get install -y libsndfile1-dev | ||
- run: pip install .[flax,testing,sentencepiece,vision,flax-speech] | ||
- run: pip install https://github.com/kpu/kenlm/archive/master.zip | ||
- save_cache: | ||
key: v0.4-flax-{{ checksum "setup.py" }} | ||
paths: | ||
|
@@ -407,6 +418,7 @@ jobs: | |
- run: pip install --upgrade pip | ||
- run: pip install .[sklearn,torch,testing,sentencepiece,torch-speech,vision,timm] | ||
- run: pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.10.0+cpu.html | ||
- run: pip install https://github.com/kpu/kenlm/archive/master.zip | ||
- save_cache: | ||
key: v0.4-torch-{{ checksum "setup.py" }} | ||
paths: | ||
|
@@ -443,6 +455,7 @@ jobs: | |
- run: pip install --upgrade pip | ||
- run: pip install .[sklearn,torch,testing,sentencepiece,torch-speech,vision,timm] | ||
- run: pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.10.0+cpu.html | ||
- run: pip install https://github.com/kpu/kenlm/archive/master.zip | ||
- save_cache: | ||
key: v0.4-torch-{{ checksum "setup.py" }} | ||
paths: | ||
|
@@ -582,7 +595,7 @@ jobs: | |
path: ~/transformers/examples_output.txt | ||
- store_artifacts: | ||
path: ~/transformers/reports | ||
|
||
run_examples_torch_all: | ||
working_directory: ~/transformers | ||
docker: | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this package? The import error indicate to do
pip install pyctcdecode
later on and do not give any instruction to install this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pyctcdecode
optionally depends on kenlm if the user would like to use akenlm
language model. In the future, there will probably be more language models that don't requirekenlm
.So IMO, it's the responsibility of the
pyctcdecode
package to throw a good error in case a user requestspyctcdecode
with akenlm
language model. However since at the moment the only language model support is based onkenlm
I can also throw a nice error message on our side.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a plan to add a realy Python package for
kenlm
? This is a bit heavy :-(There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I'm really not sure the
kenlm
repo doesn't seem to be super active: https://github.com/kpu/kenlm .It is however the by far most library for language model supported ASR.
Flashlight uses it: https://github.com/flashlight/flashlight/tree/main/bindings/python#dependencies among many other libraries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Espnet uses it as well: https://github.com/espnet/espnet/blob/master/espnet/nets/scorers/ngram.py