CorentinJ / Real-Time-Voice-Cloning

Clone a voice in 5 seconds to generate arbitrary speech in real-time
Other
52.29k stars 8.75k forks source link

RuntimeError Corrupted. #1278

Open CoinKing-Dream opened 9 months ago

CoinKing-Dream commented 9 months ago

I try to implement the project by using "py demo_cli.py" command.

Testing your configuration with small inputs. Testing the encoder... Testing the synthesizer... (loading the model will output a lot of text) Trainable Parameters: 30.870M Traceback (most recent call last): File "demo_cli.py", line 94, in mels = synthesizer.synthesize_spectrograms(texts, embeds) File "C:\Users\12-lsr\Music\Real-Time-Voice-Cloning-master\synthesizer\inference.py", line 86, in synthesize_spectrograms self.load() File "C:\Users\12-lsr\Music\Real-Time-Voice-Cloning-master\synthesizer\inference.py", line 64, in load self._model.load(self.model_fpath) File "C:\Users\12-lsr\Music\Real-Time-Voice-Cloning-master\synthesizer\models\tacotron.py", line 496, in load checkpoint = torch.load(str(path), map_location=device) File "C:\Users\12-lsr\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\serialization.py", line 1028, in load return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args) File "C:\Users\12-lsr\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\serialization.py", line 1264, in _legacy_load typed_storage._untyped_storage._set_from_file( RuntimeError: storage has wrong byte size: expected %ld got %ld04096

DevBuddyConnor commented 5 months ago

根据提交的问题描述,您在运行demo_cli.py命令时遇到了一个RuntimeError,具体错误是关于PyTorch加载模型的存储具有错误的字节大小。这个问题通常是由于模型文件损坏或不兼容造成的。

解决方案

  1. 检查PyTorch版本:首先确保您的PyTorch版本与用于训练模型的版本相兼容。如果版本不正确,可能导致加载模型时出现问题。您可以考虑升级或降级PyTorch版本。

  2. 重新下载模型文件:模型文件可能在下载过程中损坏。请尝试重新下载模型,并确保下载完整无误。

  3. 清理和重建环境:如果上述两种方法都无法解决问题,您可以考虑在一个新的虚拟环境中重新安装所有依赖,并再次尝试运行程序。

示例代码

以下是在新的虚拟环境中重新设置项目的示例操作:

# 创建新的虚拟环境
python -m venv rtvc-env

# 激活虚拟环境 (Windows)
rtvc-env\Scripts\activate

# 激活虚拟环境 (Unix/macOS)
source rtvc-env/bin/activate

# 在新的虚拟环境中安装依赖
pip install -r requirements.txt

# 重新下载模型文件到指定位置
# 注意替换下面的URL为模型文件实际的下载地址
wget -O path/to/model/file "model-download-url"

请按照项目文档指示的步骤下载模型文件,并将其放置在适当的路径下。如果项目提供了检查模型文件完整性的方法(如checksum),请确保验证模型文件。

希望这些方法能帮助您解决遇到的问题。如果问题依然存在,建议查看项目的Issues页面看看是否有其他人遇到了类似的问题以及可能的解决方案,或者向项目提交新的Issue以获得更多帮助。

[注意] 该Comment由AI生成,仅供参考。