yangdongchao / AcademiCodec

AcademiCodec: An Open Source Audio Codec Model for Academic Research
574 stars 80 forks source link

When I use the pre-trained model to inference about Encodec and HiFi-Codec, an identical error occurs #12

Closed GitYesm closed 1 year ago

GitYesm commented 1 year ago

(soundstream) root@autodl-container-1cb1119f52-820c06c3:~/autodl-tmp/paper/HiFi-Codec# bash test.sh checkpoint path: ./checkpoint/HiFi-Codec-24k-240d Init model and load weights Traceback (most recent call last): File "./vqvae_copy_syn.py", line 35, in model = VqvaeTester(args) File "/root/autodl-tmp/paper/HiFi-Codec/vqvae_tester.py", line 20, in init self.vqvae = VQVAE(hp.config_path, hp.model_path, with_encoder=True) File "/root/autodl-tmp/paper/HiFi-Codec/vqvae.py", line 12, in init ckpt = torch.load(ckpt_path) File "/root/miniconda3/envs/soundstream/lib/python3.8/site-packages/torch/serialization.py", line 815, in load return _legacy_load(opened_file, map_location, pickle_module, pickle_load_args) File "/root/miniconda3/envs/soundstream/lib/python3.8/site-packages/torch/serialization.py", line 1033, in _legacy_load magic_number = pickle_module.load(f, pickle_load_args) _pickle.UnpicklingError: invalid load key, '<'.

GitYesm commented 1 year ago

Sorry, I found that you updated some details yesterday, I tried again and found that the sample_rate about /HiFi-Codec-16k-320d/vqvae_copy_syn.py is wrong. In addition, here is my execution command, it still the same error as before, I don't know what the problem is:

CUDA_VISIBLE_DEVICES=0 python ./vqvae_copy_syn.py \ --model_path "HiFi-Codec-16k-320d" \ --config_path config_16k_320d.json \ --input_wavdir "../test_audio/" \ --outputdir "./output/" \ --num_gens 10000

Error : (soundstream) root@autodl-container-1cb1119f52-820c06c3:~/autodl-tmp/paper/HiFi-Codec-16k-320d# CUDA_VISIBLE_DEVICES=0 python ./vqvae_copy_syn.py \

--model_path "./HiFi-Codec-16k-320d" \
--config_path config_16k_320d.json \
--input_wavdir "../test_audio/" \
--outputdir "./output/" \
--num_gens 10000

Init model and load weights Traceback (most recent call last): File "./vqvae_copy_syn.py", line 35, in model = VqvaeTester(args) File "/root/autodl-tmp/paper/HiFi-Codec-16k-320d/vqvae_tester.py", line 20, in init self.vqvae = VQVAE(hp.config_path, hp.model_path, with_encoder=True) File "/root/autodl-tmp/paper/HiFi-Codec-16k-320d/vqvae.py", line 12, in init ckpt = torch.load(ckpt_path) File "/root/miniconda3/envs/soundstream/lib/python3.8/site-packages/torch/serialization.py", line 815, in load return _legacy_load(opened_file, map_location, pickle_module, pickle_load_args) File "/root/miniconda3/envs/soundstream/lib/python3.8/site-packages/torch/serialization.py", line 1033, in _legacy_load magic_number = pickle_module.load(f, pickle_load_args) _pickle.UnpicklingError: invalid load key, '<'.

GitYesm commented 1 year ago

Sorry, I found that you updated some details yesterday, I tried again and found that the sample_rate about /HiFi-Codec-16k-320d/vqvae_copy_syn.py is wrong. In addition, here is my execution command, it still the same error as before, I don't know what the problem is:

CUDA_VISIBLE_DEVICES=0 python ./vqvae_copy_syn.py --model_path "HiFi-Codec-16k-320d" --config_path config_16k_320d.json --input_wavdir "../test_audio/" --outputdir "./output/" --num_gens 10000

Error : (soundstream) root@autodl-container-1cb1119f52-820c06c3:~/autodl-tmp/paper/HiFi-Codec-16k-320d# CUDA_VISIBLE_DEVICES=0 python ./vqvae_copy_syn.py \

--model_path "./HiFi-Codec-16k-320d" \
--config_path config_16k_320d.json \
--input_wavdir "../test_audio/" \
--outputdir "./output/" \
--num_gens 10000

Init model and load weights Traceback (most recent call last): File "./vqvae_copy_syn.py", line 35, in model = VqvaeTester(args) File "/root/autodl-tmp/paper/HiFi-Codec-16k-320d/vqvae_tester.py", line 20, in init self.vqvae = VQVAE(hp.config_path, hp.model_path, with_encoder=True) File "/root/autodl-tmp/paper/HiFi-Codec-16k-320d/vqvae.py", line 12, in init ckpt = torch.load(ckpt_path) File "/root/miniconda3/envs/soundstream/lib/python3.8/site-packages/torch/serialization.py", line 815, in load return _legacy_load(opened_file, map_location, pickle_module, pickle_load_args) File "/root/miniconda3/envs/soundstream/lib/python3.8/site-packages/torch/serialization.py", line 1033, in _legacy_load magic_number = pickle_module.load(f, pickle_load_args) _pickle.UnpicklingError: invalid load key, '<'.

Version: Pytorch:2.0.1+cu118 Python: 3.8

GitYesm commented 1 year ago

Sorry, I found that you updated some details yesterday, I tried again and found that the sample_rate about /HiFi-Codec-16k-320d/vqvae_copy_syn.py is wrong. In addition, here is my execution command, it still the same error as before, I don't know what the problem is: CUDA_VISIBLE_DEVICES=0 python ./vqvae_copy_syn.py --model_path "HiFi-Codec-16k-320d" --config_path config_16k_320d.json --input_wavdir "../test_audio/" --outputdir "./output/" --num_gens 10000 Error : (soundstream) root@autodl-container-1cb1119f52-820c06c3:~/autodl-tmp/paper/HiFi-Codec-16k-320d# CUDA_VISIBLE_DEVICES=0 python ./vqvae_copy_syn.py \

--model_path "./HiFi-Codec-16k-320d" \
--config_path config_16k_320d.json \
--input_wavdir "../test_audio/" \
--outputdir "./output/" \
--num_gens 10000

Init model and load weights Traceback (most recent call last): File "./vqvae_copy_syn.py", line 35, in model = VqvaeTester(args) File "/root/autodl-tmp/paper/HiFi-Codec-16k-320d/vqvae_tester.py", line 20, in init self.vqvae = VQVAE(hp.config_path, hp.model_path, with_encoder=True) File "/root/autodl-tmp/paper/HiFi-Codec-16k-320d/vqvae.py", line 12, in init ckpt = torch.load(ckpt_path) File "/root/miniconda3/envs/soundstream/lib/python3.8/site-packages/torch/serialization.py", line 815, in load return _legacy_load(opened_file, map_location, pickle_module, pickle_load_args) File "/root/miniconda3/envs/soundstream/lib/python3.8/site-packages/torch/serialization.py", line 1033, in _legacy_load magic_number = pickle_module.load(f, pickle_load_args) _pickle.UnpicklingError: invalid load key, '<'.

Version: Pytorch:2.0.1+cu118 Python: 3.8

This problem has been solved: wget https://huggingface.co/Dongchao/AcademiCodec/blob/main/HiFi-Codec-16k-320d not a good choice (My opinion). The reason as follows: I find wget the pre-train_model only 34.4KB,I don't konw what happening .
The soloved as follows: Transfer with Xftp or others,but please notice the size about pre-model