-
Notifications
You must be signed in to change notification settings - Fork 304
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
Use piper_phonemize as text tokenizer in ljspeech recipe #1511
Merged
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
27b1bf4
minor fix of vits/tokenizer.py
yaozengwei ff6784d
minor fix of vits/tokenizer.py
yaozengwei 2cf5891
use piper_phonemize as text tokenizer in ljspeech recipe
yaozengwei e774912
Merge branch 'master' of github.com:k2-fsa/icefall into update-vits-t…
yaozengwei cb04833
remove extra tokens
yaozengwei 1851443
minor updates
yaozengwei 595d4a3
modify usage of tokenizer in vits/train.py
yaozengwei ae83d80
minor updates related to the tokenizer change
yaozengwei 956e58f
update docs
yaozengwei 1d66426
update huggingface link
yaozengwei 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
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
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -38,12 +38,15 @@ def __init__(self, tokens: str): | |||||||||
id = int(info[0]) | ||||||||||
else: | ||||||||||
token, id = info[0], int(info[1]) | ||||||||||
assert token not in self.token2id, token | ||||||||||
self.token2id[token] = id | ||||||||||
|
||||||||||
self.blank_id = self.token2id["<blk>"] | ||||||||||
self.sos_id = self.token2id["<sos>"] | ||||||||||
self.eos_id = self.token2id["<eos>"] | ||||||||||
self.oov_id = self.token2id["<unk>"] | ||||||||||
# Refer to https://github.com/rhasspy/piper/blob/master/TRAINING.md | ||||||||||
self.pad_id = self.token2id["_"] # padding | ||||||||||
self.sos_id = self.token2id["^"] # beginning of an utterance (bos) | ||||||||||
self.eos_id = self.token2id["$"] # end of an utterance (eos) | ||||||||||
self.space_id = self.token2id[" "] # word separator (whitespace) | ||||||||||
|
||||||||||
self.vocab_size = len(self.token2id) | ||||||||||
|
||||||||||
def texts_to_token_ids( | ||||||||||
|
@@ -80,13 +83,11 @@ def texts_to_token_ids( | |||||||||
|
||||||||||
token_ids = [] | ||||||||||
for t in tokens: | ||||||||||
if t in self.token2id: | ||||||||||
token_ids.append(self.token2id[t]) | ||||||||||
else: | ||||||||||
token_ids.append(self.oov_id) | ||||||||||
assert t in self.token2id, t | ||||||||||
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.
Suggested change
We just skip OOVs instead of throwing an assertion error, which |
||||||||||
token_ids.append(self.token2id[t]) | ||||||||||
|
||||||||||
if intersperse_blank: | ||||||||||
token_ids = intersperse(token_ids, self.blank_id) | ||||||||||
token_ids = intersperse(token_ids, self.pad_id) | ||||||||||
if add_sos: | ||||||||||
token_ids = [self.sos_id] + token_ids | ||||||||||
if add_eos: | ||||||||||
|
@@ -122,13 +123,11 @@ def tokens_to_token_ids( | |||||||||
for tokens in tokens_list: | ||||||||||
token_ids = [] | ||||||||||
for t in tokens: | ||||||||||
if t in self.token2id: | ||||||||||
token_ids.append(self.token2id[t]) | ||||||||||
else: | ||||||||||
token_ids.append(self.oov_id) | ||||||||||
assert t in self.token2id, t | ||||||||||
token_ids.append(self.token2id[t]) | ||||||||||
|
||||||||||
if intersperse_blank: | ||||||||||
token_ids = intersperse(token_ids, self.blank_id) | ||||||||||
token_ids = intersperse(token_ids, self.pad_id) | ||||||||||
if add_sos: | ||||||||||
token_ids = [self.sos_id] + token_ids | ||||||||||
if add_eos: | ||||||||||
|
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.
Could you sort by token_id in
filename
?That is, sort the second column from 0 to vocab_size-1 in ascending order?
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.
Ok.