MeloTTS icon indicating copy to clipboard operation
MeloTTS copied to clipboard

Connection required after initialization

Open ViniciusMeirelles opened this issue 10 months ago • 1 comments
trafficstars

I want to run Melo on a closed system without internet connection. I first initialize Melo and let it download everything it needs, then I even generate one audio file to make sure it works. After that, I disable outgoing connections, and this causes speech synthesis to fail.

MaxRetryError('HTTPSConnectionPool(host=\'cdn-lfs.hf.co\', port=443): Max retries exceeded with url: /bert-base-uncased/68d45e234eb4a928074dfd868cead0219ab85354cc53d20e772753c6bb9169d3?response-content-disposition=inline%3B+filename*%3DUTF-8%27%27model.safetensors%3B+filename%3D%22model.safetensors%22%3B&Expires=1735500857&Policy=eyJTdGF0ZW1lbnQiOlt7IkNvbmRpdGlvbiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTczNTUwMDg1N319LCJSZXNvdXJjZSI6Imh0dHBzOi8vY2RuLWxmcy5oZi5jby9iZXJ0LWJhc2UtdW5jYXNlZC82OGQ0NWUyMzRlYjRhOTI4MDc0ZGZkODY4Y2VhZDAyMTlhYjg1MzU0Y2M1M2QyMGU3NzI3NTNjNmJiOTE2OWQzP3Jlc3BvbnNlLWNvbnRlbnQtZGlzcG9zaXRpb249KiJ9XX0_&Signature=doW6dYUDL0Ed-c9lXmekerqPhaZeba-xvjQBM6pv71~qb0CJ0C9cUo-a52UDE0WpoohpMpK2mGAvFXZWxZfBa0Z9rVM2DuJt-rWwGlfMsQrDrNGdaBJP-iMblbnkx3~9-yvukMwFBMyu4Bc2-JCJe4lAodZ1OnIzu4xFkLQAz8F6P8LCAPbNHBxn1fhBbtYgUS6Wr7ItPshvkcy3-tpDuFAnWnpEvoK9IHyzJeyFfx5LEJfQUffSh21XgwqvEZCvj8wQKC6XDei~hAN9DrCVjAsiNL9I5EK9Jnu8-0~dNJLG31w8emKZkJAh68T2Sucl5NN996ip602ELL5tNHMNig__&Key-Pair-Id=K3RPWS32NSSJCE (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7fbf34818220>: Failed to resolve \'cdn-lfs.hf.co\' ([Errno -3] Temporary failure in name resolution)"))'), '(Request ID: ac9d0a58-cc00-4c4d-b0e2-9f9f305b2c2a)'

As you can see, it's trying to download Bert. But looking at the code, once the Bert model is downloaded once, it shouldn't try to download again: https://github.com/myshell-ai/MeloTTS/blob/209145371cff8fc3bd60d7be902ea69cbdb7965a/melo/text/english_bert.py#L19

ViniciusMeirelles avatar Dec 26 '24 20:12 ViniciusMeirelles

I ran into this too and found a workaround. After running melotts command to generate audio, I then found the file file_download.py in the huggingface_hub dependency, and in the function _hf_hub_download_to_cache_dir, where it calls _get_metadata_or_catch_error, I edited the local_files_only parameter to be True:

    # Try to get metadata (etag, commit_hash, url, size) from the server.
    # If we can't, a HEAD request error is returned.
    (url_to_download, etag, commit_hash, expected_size, head_call_error) = _get_metadata_or_catch_error(
        repo_id=repo_id,
        filename=filename,
        repo_type=repo_type,
        revision=revision,
        endpoint=endpoint,
        proxies=proxies,
        etag_timeout=etag_timeout,
        headers=headers,
        token=token,
        local_files_only=True,
        storage_folder=storage_folder,
        relative_filename=relative_filename,
    )

Then it worked offline. It's a hack, but maybe helpful to you.

ghost avatar Jan 04 '25 04:01 ghost