Fix error when load from latest transformers
Browse files
tokenization_bert_vits2.py
CHANGED
|
@@ -21,7 +21,7 @@ from typing import Any, Dict, List, Optional, Tuple, Union
|
|
| 21 |
|
| 22 |
from transformers.tokenization_utils import PreTrainedTokenizer
|
| 23 |
from transformers.utils import is_phonemizer_available, logging
|
| 24 |
-
from transformers.utils import
|
| 25 |
|
| 26 |
|
| 27 |
if is_phonemizer_available():
|
|
@@ -105,7 +105,7 @@ class BertVits2Tokenizer(PreTrainedTokenizer):
|
|
| 105 |
"""Converts a string of Chinese text into a list of phonemes and tones."""
|
| 106 |
from pypinyin import lazy_pinyin, Style
|
| 107 |
|
| 108 |
-
g2p_file =
|
| 109 |
|
| 110 |
with open(g2p_file, encoding="utf-8") as f:
|
| 111 |
g2p = json.load(f)
|
|
|
|
| 21 |
|
| 22 |
from transformers.tokenization_utils import PreTrainedTokenizer
|
| 23 |
from transformers.utils import is_phonemizer_available, logging
|
| 24 |
+
from transformers.utils import cached_file
|
| 25 |
|
| 26 |
|
| 27 |
if is_phonemizer_available():
|
|
|
|
| 105 |
"""Converts a string of Chinese text into a list of phonemes and tones."""
|
| 106 |
from pypinyin import lazy_pinyin, Style
|
| 107 |
|
| 108 |
+
g2p_file = cached_file(self.name_or_path, "zh_g2p.json", subfolder="data")
|
| 109 |
|
| 110 |
with open(g2p_file, encoding="utf-8") as f:
|
| 111 |
g2p = json.load(f)
|