hans00 commited on
Commit
d965a2f
·
verified ·
1 Parent(s): 8731e9c

Fix error when load from latest transformers

Browse files
Files changed (1) hide show
  1. tokenization_bert_vits2.py +2 -2
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 get_file_from_repo
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 = get_file_from_repo(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)
 
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)