open-mmlab / Amphion

Amphion (/æmˈfaɪən/) is a toolkit for Audio, Music, and Speech Generation. Its purpose is to support reproducible research and help junior researchers and engineers get started in the field of audio, music, and speech generation research and development.
https://openhlt.github.io/amphion/
MIT License
4.45k stars 379 forks source link

[BUG]: [NaturalSpeech2] AttributeError: 'JsonHParams' object has no attribute 'diffusion_type' #256

Closed cantabile-kwok closed 1 month ago

cantabile-kwok commented 1 month ago

Describe the bug

The official config ns2.json does not have diffusion.diffusion_type attribute. Meanwhile, in models/tts/naturalspeech2/ns2.py, it is required.

image

image

How To Reproduce

Steps to reproduce the behavior:

  1. Config/File changes: None
  2. Run command: bash egs/tts/NaturalSpeech2/run_inference.sh --text "[The text you want to generate]"
  3. See error:
    Traceback (most recent call last):
    File "/tools/Amphion/bins/tts/inference.py", line 169, in <module>
    main()
    File "/tools/Amphion/bins/tts/inference.py", line 162, in main
    inferencer = build_inference(args, cfg)
    File "/tools/Amphion/bins/tts/inference.py", line 29, in build_inference
    inference = inference_class(args, cfg)
    File "/tools/Amphion/models/tts/naturalspeech2/ns2_inference.py", line 29, in __init__
    self.model = self.build_model()
    File "/tools/Amphion/models/tts/naturalspeech2/ns2_inference.py", line 37, in build_model
    model = NaturalSpeech2(self.cfg.model)
    File "/tools/Amphion/models/tts/naturalspeech2/ns2.py", line 31, in __init__
    if cfg.diffusion.diffusion_type == "diffusion":
    AttributeError: 'JsonHParams' object has no attribute 'diffusion_type'

Expected behavior

Simply add

"diffusion_type": "diffusion"

into the ns2.json config will solve the problem.

cantabile-kwok commented 1 month ago

Setting config to egs/tts/NaturalSpeech2/exp_config.json solves this error. It was my mistake.