-
Notifications
You must be signed in to change notification settings - Fork 413
[not_for_merge_yet] fixing github workflows with automatic tests #2061
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
Open
KarelVesely84
wants to merge
6
commits into
k2-fsa:master
Choose a base branch
from
KarelVesely84:git_workflow_fix
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a162b11
add `kaldi_native_fbank`
KarelVesely84 cce2916
debug the github workflows with tests
KarelVesely84 c0efe90
add `rknn_toolkit2` to test env
KarelVesely84 37666ca
fixing broken link
KarelVesely84 86eb147
bugfixes, detected by flake8
KarelVesely84 f7132de
bugfixes, issues detected by flake8
KarelVesely84 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 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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| /exp/ahussein/tmp/icefall/egs/iwslt22_ta/ST/local/prepare_transcripts.py | ||
| ../../ST/local/prepare_transcripts.py |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,66 +1,66 @@ | ||
| # Copyright 2023 Johns Hopkins University (Amir Hussein) | ||
| #!/usr/bin/python | ||
| """ | ||
| This script prepares transcript_words.txt from cutset | ||
| """ | ||
| from lhotse import CutSet | ||
| import argparse | ||
| import logging | ||
| import pdb | ||
| from pathlib import Path | ||
| import os | ||
| def get_parser(): | ||
| parser = argparse.ArgumentParser( | ||
| formatter_class=argparse.ArgumentDefaultsHelpFormatter | ||
| ) | ||
| parser.add_argument( | ||
| "--cut", | ||
| type=str, | ||
| default="", | ||
| help="Cutset file", | ||
| ) | ||
| parser.add_argument( | ||
| "--src-langdir", | ||
| type=str, | ||
| default="", | ||
| help="name of the source lang-dir", | ||
| ) | ||
| parser.add_argument( | ||
| "--tgt-langdir", | ||
| type=str, | ||
| default=None, | ||
| help="name of the target lang-dir", | ||
| ) | ||
| return parser | ||
| def main(): | ||
| parser = get_parser() | ||
| args = parser.parse_args() | ||
| logging.info("Reading the cuts") | ||
| cuts = CutSet.from_file(args.cut) | ||
| if args.tgt_langdir != None: | ||
| logging.info("Target dir is not None") | ||
| langdirs = [Path(args.src_langdir), Path(args.tgt_langdir)] | ||
| else: | ||
| langdirs = [Path(args.src_langdir)] | ||
| for langdir in langdirs: | ||
| if not os.path.exists(langdir): | ||
| os.makedirs(langdir) | ||
| with open(langdirs[0] / "transcript_words.txt", 'w') as src, open(langdirs[1] / "transcript_words.txt", 'w') as tgt: | ||
| for c in cuts: | ||
| src_txt = c.supervisions[0].text | ||
| tgt_txt = c.supervisions[0].custom['translated_text']['eng'] | ||
| src.write(src_txt + '\n') | ||
| tgt.write(tgt_txt + '\n') | ||
| if __name__ == "__main__": | ||
| main() | ||
| # Copyright 2023 Johns Hopkins University (Amir Hussein) | ||
|
|
||
| #!/usr/bin/python | ||
| """ | ||
| This script prepares transcript_words.txt from cutset | ||
| """ | ||
|
|
||
| from lhotse import CutSet | ||
| import argparse | ||
| import logging | ||
| import pdb | ||
| from pathlib import Path | ||
| import os | ||
|
|
||
|
|
||
| def get_parser(): | ||
| parser = argparse.ArgumentParser( | ||
| formatter_class=argparse.ArgumentDefaultsHelpFormatter | ||
| ) | ||
| parser.add_argument( | ||
| "--cut", | ||
| type=str, | ||
| default="", | ||
| help="Cutset file", | ||
| ) | ||
| parser.add_argument( | ||
| "--src-langdir", | ||
| type=str, | ||
| default="", | ||
| help="name of the source lang-dir", | ||
| ) | ||
| parser.add_argument( | ||
| "--tgt-langdir", | ||
| type=str, | ||
| default=None, | ||
| help="name of the target lang-dir", | ||
| ) | ||
| return parser | ||
|
|
||
|
|
||
| def main(): | ||
|
|
||
| parser = get_parser() | ||
| args = parser.parse_args() | ||
|
|
||
| logging.info("Reading the cuts") | ||
| cuts = CutSet.from_file(args.cut) | ||
| if args.tgt_langdir != None: | ||
| logging.info("Target dir is not None") | ||
| langdirs = [Path(args.src_langdir), Path(args.tgt_langdir)] | ||
| else: | ||
| langdirs = [Path(args.src_langdir)] | ||
|
|
||
| for langdir in langdirs: | ||
| if not os.path.exists(langdir): | ||
| os.makedirs(langdir) | ||
|
|
||
| with open(langdirs[0] / "transcript_words.txt", 'w') as src, open(langdirs[1] / "transcript_words.txt", 'w') as tgt: | ||
| for c in cuts: | ||
| src_txt = c.supervisions[0].text | ||
| tgt_txt = c.supervisions[0].custom['translated_text']['eng'] | ||
| src.write(src_txt + '\n') | ||
| tgt.write(tgt_txt + '\n') | ||
|
Comment on lines
+51
to
+63
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. IndexError when When Proposed fix: handle single langdir case- with open(langdirs[0] / "transcript_words.txt", 'w') as src, open(langdirs[1] / "transcript_words.txt", 'w') as tgt:
- for c in cuts:
- src_txt = c.supervisions[0].text
- tgt_txt = c.supervisions[0].custom['translated_text']['eng']
- src.write(src_txt + '\n')
- tgt.write(tgt_txt + '\n')
+ if args.tgt_langdir is not None:
+ with open(langdirs[0] / "transcript_words.txt", 'w') as src, \
+ open(langdirs[1] / "transcript_words.txt", 'w') as tgt:
+ for c in cuts:
+ src_txt = c.supervisions[0].text
+ tgt_txt = c.supervisions[0].custom['translated_text']['eng']
+ src.write(src_txt + '\n')
+ tgt.write(tgt_txt + '\n')
+ else:
+ with open(langdirs[0] / "transcript_words.txt", 'w') as src:
+ for c in cuts:
+ src_txt = c.supervisions[0].text
+ src.write(src_txt + '\n')🤖 Prompt for AI Agents |
||
|
|
||
| if __name__ == "__main__": | ||
| main() | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| ../../../librispeech/ASR/zipformer/profile.py | ||
| ../../ASR/zipformer/profile.py |
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
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
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.
Shebang should be at the beginning of the file.
The shebang (
#!/usr/bin/python) on line 3 should come before the copyright comment on line 1 to be recognized by the shell.Proposed fix
📝 Committable suggestion
🧰 Tools
🪛 Ruff (0.14.13)
3-3: Shebang should be at the beginning of the file
(EXE005)
🤖 Prompt for AI Agents