[2noise/ChatTTS]_pickle.UnpicklingError: invalid load key, 'v'.

2024-06-05 945 views
4

image

回答

0
我也遇到了这个差不多的问题,请问你解决了吗

UnpicklingError Traceback (most recent call last) Cell In[4], line 2 1 chat = ChatTTS.Chat() ----> 2 chat.load_models() 4 # Use force_redownload=True if the weights updated. 5 # chat.load_models(force_redownload=True) 6 7 # If you download the weights manually, set source='locals'. 8 # chat.load_models(source='locals', local_path='YOUR LOCAL PATH')

File f:\deep_learning\NLP\ChatTTS-main\ChatTTS\core.py:61, in Chat.load_models(self, source, force_redownload, local_path, kwargs) 58 self.logger.log(logging.INFO, f'Load from local: {local_path}') 59 download_path = local_path ---> 61 self._load({k: os.path.join(download_path, v) for k, v in OmegaConf.load(os.path.join(download_path, 'config', 'path.yaml')).items()}, **kwargs)

File f:\deep_learning\NLP\ChatTTS-main\ChatTTS\core.py:100, in Chat._load(self, vocos_config_path, vocos_ckpt_path, dvae_config_path, dvae_ckpt_path, gpt_config_path, gpt_ckpt_path, decoder_config_path, decoder_ckpt_path, tokenizer_path, device, compile) 98 gpt = GPT_warpper(**cfg).to(device).eval() 99 assert gpt_ckpt_path, 'gpt_ckpt_path should not be None' --> 100 gpt.load_state_dict(torch.load(gpt_ckpt_path, map_location='cpu')) 101 if compile: 102 gpt.gpt.forward = torch.compile(gpt.gpt.forward, backend='inductor', dynamic=True)

File e:\software\Anaconda3\envs\flask1\lib\site-packages\torch\serialization.py:1040, in load(f, map_location, pickle_module, weights_only, mmap, pickle_load_args) 1038 except RuntimeError as e: 1039 raise pickle.UnpicklingError(UNSAFE_MESSAGE + str(e)) from None -> 1040 return _legacy_load(opened_file, map_location, pickle_module, pickle_load_args)

File e:\software\Anaconda3\envs\flask1\lib\site-packages\torch\serialization.py:1262, in _legacy_load(f, map_location, pickle_module, pickle_load_args) 1256 if not hasattr(f, 'readinto') and (3, 8, 0) <= sys.version_info < (3, 8, 2): 1257 raise RuntimeError( 1258 "torch.load does not work with file-like objects that do not implement readinto on Python 3.8.0 and 3.8.1. " 1259 f"Received object of type \"{type(f)}\". Please update to Python 3.8.2 or newer to restore this " 1260 "functionality.") -> 1262 magic_number = pickle_module.load(f, pickle_load_args) 1263 if magic_number != MAGIC_NUMBER: 1264 raise RuntimeError("Invalid magic number; corrupt file?")

UnpicklingError: invalid load key, '<'.

8

没得

4

确认可用,下载的文件大小应该是

image
7

确认可用,下载的文件大小应该是 image

你好!我使用您的方法确实能够下载,但是依旧报错 (我把下载的模型放到了 image )。 image 我运行的脚本是提供的样例 image

4

确认可用,下载的文件大小应该是 image

对,我感觉我这个小了好多

3

确认可用,下载的文件大小应该是 image

你好!我使用您的方法确实能够下载,但是依旧报错 (我把下载的模型放到了 image )。 image 我运行的脚本是提供的样例 image

我也一样,拷贝后还是报和你一样的错,初步判断应该是拷贝的这个文件内容不完整导致

4

来晚了,我设置好路径之后直接可用了