-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
refactor(yaml): Config ctc/cmvn/tokenizer in train.yaml #2205
Merged
Conversation
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
xingchensong
force-pushed
the
xcsong-yaml
branch
from
December 8, 2023 12:22
6e2941e
to
2a1ede8
Compare
great work |
Mddct
previously approved these changes
Dec 8, 2023
TODO
|
robin1001
requested changes
Dec 8, 2023
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.
周哥,这个改动比较大,功能也很杂,强烈建议分开提 PR,每个 PR 只做一个功能,来自 Google 软件实践指南中的建议。
记一个TODO,后面runtime也要针对special id做对应的修改,比如blanckid不是0,sos不是vocabsize-1等 |
xingchensong
force-pushed
the
xcsong-yaml
branch
from
December 12, 2023 04:00
97d44a1
to
a1fb531
Compare
模型转换脚本(sos从vocabsize-1变成2) import torch [3/528]
old_state = torch.load('/mnt/d/BaiduSyncdisk/downloads/ckpt/20210601_u2++_conformer_exp_aishell/final.pt')
new_state = {}
change_list = ['decoder.left_decoder.output_layer.weight',
'decoder.left_decoder.output_layer.bias',
'decoder.left_decoder.embed.0.weight',
'decoder.right_decoder.output_layer.weight',
'decoder.right_decoder.output_layer.bias',
'decoder.right_decoder.embed.0.weight',
'ctc.ctc_lo.weight',
'ctc.ctc_lo.bias']
for key in old_state.keys():
if key in change_list:
print("processing {}, {}".format(key, old_state[key].size()))
tensor = old_state[key]
new_tensor = torch.zeros_like(tensor)
if len(tensor.size()) == 2: # weight
new_tensor[:2, :] = tensor[:2, :]
new_tensor[2, :] = tensor[-1, :]
new_tensor[3:, :] = tensor[2:-1, :]
elif len(tensor.size()) == 1: # bias
new_tensor[:2] = tensor[:2]
new_tensor[2] = tensor[-1]
new_tensor[3:] = tensor[2:-1]
else:
raise NotImplementedError
new_state[key] = new_tensor
elif "concat_linear" in key:
continue
else:
new_state[key] = old_state[key]
torch.save(new_state, "/mnt/d/BaiduSyncdisk/downloads/ckpt/20210601_u2++_conformer_exp_aishell/final.sos2.pt") |
xingchensong
force-pushed
the
xcsong-yaml
branch
from
December 12, 2023 10:18
04bfb7a
to
b8cb316
Compare
Mddct
previously approved these changes
Dec 12, 2023
xingchensong
force-pushed
the
xcsong-yaml
branch
from
December 13, 2023 01:26
b0f34a0
to
389d5f7
Compare
Mddct
approved these changes
Dec 13, 2023
robin1001
approved these changes
Dec 13, 2023
This was referenced Dec 13, 2023
This was referenced Dec 13, 2023
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.
TODO (current PR)
TODO (next PR)