Fixed bug when downloading phonemizer model [skip ci]

This commit is contained in:
dscripka 2023-10-12 12:01:30 -04:00
parent a99d5f732f
commit 9a23c43ab4

View file

@ -925,6 +925,8 @@ def generate_adversarial_texts(input_text: str, N: int, include_partial_phrase:
# Download phonemizer model for OOV words, if needed
if [] in input_text_phones:
phonemizer_mdl_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "resources", "en_us_cmudict_forward.pt")
if not os.path.exists(os.path.join(os.path.dirname(os.path.abspath(__file__)), "resources")):
os.mkdir(os.path.join(os.path.dirname(os.path.abspath(__file__)), "resources"))
if not os.path.exists(phonemizer_mdl_path):
logging.warning("Downloading phonemizer model from DeepPhonemizer library...")
import requests