Skip to content

Commit

Permalink
deprecation warning is only triggered when old models applied old g2p.
Browse files Browse the repository at this point in the history
Signed-off-by: Xuesong Yang <1646669+XuesongYang@users.noreply.github.com>
  • Loading branch information
XuesongYang committed May 26, 2023
1 parent 9c59b66 commit bc3e5e1
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 6 deletions.
6 changes: 5 additions & 1 deletion nemo/collections/tts/models/aligner.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ def _setup_tokenizer(self, cfg):
text_tokenizer_kwargs = {}
if "g2p" in cfg.text_tokenizer:
# for backward compatibility
if self._is_model_being_restored():
if (
self._is_model_being_restored()
and (not cfg.text_tokenizer.g2p.get('_target_', None))
and cfg.text_tokenizer.g2p["_target_"].startswith("nemo_text_processing.g2p")
):
cfg.text_tokenizer.g2p["_target_"] = g2p_backward_compatible_support(
cfg.text_tokenizer.g2p["_target_"]
)
Expand Down
6 changes: 5 additions & 1 deletion nemo/collections/tts/models/fastpitch.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,11 @@ def _setup_tokenizer(self, cfg):

if "g2p" in cfg.text_tokenizer:
# for backward compatibility
if self._is_model_being_restored():
if (
self._is_model_being_restored()
and (not cfg.text_tokenizer.g2p.get('_target_', None))
and cfg.text_tokenizer.g2p["_target_"].startswith("nemo_text_processing.g2p")
):
cfg.text_tokenizer.g2p["_target_"] = g2p_backward_compatible_support(
cfg.text_tokenizer.g2p["_target_"]
)
Expand Down
6 changes: 5 additions & 1 deletion nemo/collections/tts/models/mixer_tts.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,11 @@ def _setup_tokenizer(self, cfg):
text_tokenizer_kwargs = {}
if "g2p" in cfg.text_tokenizer:
# for backward compatibility
if self._is_model_being_restored():
if (
self._is_model_being_restored()
and (not cfg.text_tokenizer.g2p.get('_target_', None))
and cfg.text_tokenizer.g2p["_target_"].startswith("nemo_text_processing.g2p")
):
cfg.text_tokenizer.g2p["_target_"] = g2p_backward_compatible_support(
cfg.text_tokenizer.g2p["_target_"]
)
Expand Down
6 changes: 5 additions & 1 deletion nemo/collections/tts/models/radtts.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,11 @@ def _setup_tokenizer(self, cfg):
text_tokenizer_kwargs = {}
if "g2p" in cfg.text_tokenizer:
# for backward compatibility
if self._is_model_being_restored():
if (
self._is_model_being_restored()
and (not cfg.text_tokenizer.g2p.get('_target_', None))
and cfg.text_tokenizer.g2p["_target_"].startswith("nemo_text_processing.g2p")
):
cfg.text_tokenizer.g2p["_target_"] = g2p_backward_compatible_support(
cfg.text_tokenizer.g2p["_target_"]
)
Expand Down
6 changes: 5 additions & 1 deletion nemo/collections/tts/models/tacotron2.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,11 @@ def _setup_tokenizer(self, cfg):
text_tokenizer_kwargs = {}
if "g2p" in cfg.text_tokenizer and cfg.text_tokenizer.g2p is not None:
# for backward compatibility
if self._is_model_being_restored():
if (
self._is_model_being_restored()
and (not cfg.text_tokenizer.g2p.get('_target_', None))
and cfg.text_tokenizer.g2p["_target_"].startswith("nemo_text_processing.g2p")
):
cfg.text_tokenizer.g2p["_target_"] = g2p_backward_compatible_support(
cfg.text_tokenizer.g2p["_target_"]
)
Expand Down
6 changes: 5 additions & 1 deletion nemo/collections/tts/models/vits.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,11 @@ def _setup_tokenizer(self, cfg):
text_tokenizer_kwargs = {}
if "g2p" in cfg.text_tokenizer and cfg.text_tokenizer.g2p is not None:
# for backward compatibility
if self._is_model_being_restored():
if (
self._is_model_being_restored()
and (not cfg.text_tokenizer.g2p.get('_target_', None))
and cfg.text_tokenizer.g2p["_target_"].startswith("nemo_text_processing.g2p")
):
cfg.text_tokenizer.g2p["_target_"] = g2p_backward_compatible_support(
cfg.text_tokenizer.g2p["_target_"]
)
Expand Down

0 comments on commit bc3e5e1

Please sign in to comment.