coqui-ai / TTS

🐸💬 - a deep learning toolkit for Text-to-Speech, battle-tested in research and production
http://coqui.ai
Mozilla Public License 2.0
35.08k stars 4.27k forks source link

[Bug] Runtime error trying to use train_yourtts.py #2444

Closed thoraxe closed 1 year ago

thoraxe commented 1 year ago

Describe the bug

I am trying to use the train_yourtts.py recipe from: https://github.com/coqui-ai/TTS/blob/v0.12.0/recipes/vctk/yourtts/train_yourtts.py

In fact, I pared down the VCTK dataset to attempt to reproduce the error, and I can reliably reproduce it with minimal changes to the original script.

Changes I made:

I moved everything but p225 out of the VCTK location to prevent the embeddings from being calculated to save time for the reproducer -- the embedding calculation does not honor the ignored_speakers

The following Gist has both my exact script, as run, as well as the output: https://gist.github.com/thoraxe/308bcb97f1ba57ad94ab6957bc2525ba

To Reproduce

See the above steps, and the Gist with the script.

Expected behavior

YourTTS should successfully train.

Logs

See gist.

Environment

{
    "CUDA": {
        "GPU": [
            "NVIDIA GeForce RTX 3080"
        ],
        "available": true,
        "version": "11.8"
    },
    "Packages": {
        "PyTorch_debug": false,
        "PyTorch_version": "2.0.0+cu118",
        "TTS": "0.12.0",
        "numpy": "1.21.6"
    },
    "System": {
        "OS": "Windows",
        "architecture": [
            "64bit",
            "WindowsPE"
        ],
        "processor": "Intel64 Family 6 Model 151 Stepping 2, GenuineIntel",
        "python": "3.9.12",
        "version": "10.0.22000"
    }
}
erogol commented 1 year ago

wat's the error?

Harrolee commented 1 year ago

If this is the error:

RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.

You should be able to get around it by indenting the python code in [train_yourtts.py](https://gist.github.com/thoraxe/308bcb97f1ba57ad94ab6957bc2525ba#file-train_yourtts-py) under an if __name__ == '__main__': statement.

I threw the same error on a macbook while training GlowTTS. Adding the if __name__ == '__main__': idiom resolved the error for me.

Python's multiprocessing library threw this, not coqui's TTS. The RuntimeError is thrown on Windows or Mac because these platforms do not support fork. Instead, spawn is used. Checkout context.py in the Python lib dir. For more about fork and spawn, [read here].(https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods)

erogol commented 1 year ago

Closed this due to inactivity.