modelscope / FunCodec

FunCodec is a research-oriented toolkit for audio quantization and downstream applications, such as text-to-speech synthesis, music generation et.al.
https://funcodec.github.io/
MIT License
370 stars 30 forks source link

zipfile.BadZipFile: File is not a zip file #38

Open lemonLCT opened 7 months ago

lemonLCT commented 7 months ago

Issue Decription : I followed the instructions in the README.md step by step, until I encountered the following problem when I executed the command in the order described under “Use LauraTTS to synthesize speech”: bash demo.sh --stage 1 --model_name ${model_name} --output_dir results --text "nothing was to be done but to put about, and return in disappointment towards the north."

I encountered the following:

Traceback (most recent call last):
  File "/root/miniconda3/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/root/miniconda3/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/root/FunCodec/funcodec/bin/text2audio_inference.py", line 561, in <module>
    main()
  File "/root/FunCodec/funcodec/bin/text2audio_inference.py", line 557, in main
    inference(**kwargs)
  File "/root/FunCodec/funcodec/bin/text2audio_inference.py", line 381, in inference
    inference_pipeline = inference_func(
  File "/root/FunCodec/funcodec/bin/text2audio_inference.py", line 287, in inference_func
    my_model = Text2Audio.from_pretrained(
  File "/root/FunCodec/funcodec/bin/text2audio_inference.py", line 227, in from_pretrained
    return Text2Audio(**kwargs)
  File "/root/FunCodec/funcodec/bin/text2audio_inference.py", line 75, in __init__
    from funcodec.text.phoneme_tokenizer import G2p_en
  File "/root/FunCodec/funcodec/text/phoneme_tokenizer.py", line 10, in <module>
    import g2p_en
  File "/root/miniconda3/lib/python3.8/site-packages/g2p_en/__init__.py", line 1, in <module>
    from .g2p import G2p
  File "/root/miniconda3/lib/python3.8/site-packages/g2p_en/g2p.py", line 26, in <module>
    nltk.data.find('corpora/cmudict.zip')
  File "/root/miniconda3/lib/python3.8/site-packages/nltk/data.py", line 542, in find
    return ZipFilePathPointer(p, zipentry)
  File "/root/miniconda3/lib/python3.8/site-packages/nltk/compat.py", line 41, in _decorator
    return init_func(*args, **kwargs)
  File "/root/miniconda3/lib/python3.8/site-packages/nltk/data.py", line 394, in __init__
    zipfile = OpenOnDemandZipFile(os.path.abspath(zipfile))
  File "/root/miniconda3/lib/python3.8/site-packages/nltk/compat.py", line 41, in _decorator
    return init_func(*args, **kwargs)
  File "/root/miniconda3/lib/python3.8/site-packages/nltk/data.py", line 935, in __init__
    zipfile.ZipFile.__init__(self, filename)
  File "/root/miniconda3/lib/python3.8/zipfile.py", line 1269, in __init__
    self._RealGetContents()
  File "/root/miniconda3/lib/python3.8/zipfile.py", line 1336, in _RealGetContents
    raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file

question : I have already downloaded the relevant two models, but encountered an error during the process of executing speech synthesis. I am eager to experience your project and would greatly appreciate your guidance or suggestions for resolving this issue.

ZhihaoDU commented 7 months ago

This error is raised by the g2p_en python module, which is used to transform the English text into phonemes. I think this is because some resources (nltk, 'corpora/cmudict.zip') required by g2p_en have not beed properly downloaded probably due to the network errors, If you are in the mainland of China. I recommend you search the issue on Google to find some solutions. Note that this error is not caused by FunCodec itself.