AudioLDM
AudioLDM copied to clipboard
RuntimeError: PytorchStreamReader failed reading file data/11: invalid header or archive is corrupted
Nutshell
Running
audioldm -t "A hammer is hitting a wooden surface"
in terminal leads me to
RuntimeError: PytorchStreamReader failed reading file data/11: invalid header or archive is corrupted
Environment
Installed through pip install audioldm
on a mac (macOS Monterey 12.5.1), in python 3.10.
Other details in case it helps
When running (in a jupyter notebook)
from audioldm.pipeline import text_to_audio, build_model
f = lambda text: text_to_audio(build_model(), text)
I get the same error, but with some prior stuff:
A print:
DiffusionWrapper has 185.04 M params.
Then some warnings:
~/.pyenv/versions/3.10.8/lib/python3.10/site-packages/torchlibrosa/stft.py:193: FutureWarning: Pass size=1024 as keyword args. From version 0.10 passing these as positional arguments will result in an error
fft_window = librosa.util.pad_center(fft_window, n_fft)
~/.pyenv/versions/3.10.8/lib/python3.10/site-packages/torch/functional.py:504: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at /Users/runner/work/pytorch/pytorch/pytorch/aten/src/ATen/native/TensorShape.cpp:3191.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
Some weights of the model checkpoint at roberta-base were not used when initializing RobertaModel: ['lm_head.dense.weight', 'lm_head.layer_norm.weight', 'lm_head.decoder.weight', 'lm_head.layer_norm.bias', 'lm_head.dense.bias', 'lm_head.bias']
- This IS expected if you are initializing RobertaModel from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).
- This IS NOT expected if you are initializing RobertaModel from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).
And then the traceback:
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
Cell In[5], line 1
----> 1 t = f('nice gentle sound')
Cell In[4], line 3, in <lambda>(text)
1 from audioldm.pipeline import text_to_audio, build_model
----> 3 f = lambda text: text_to_audio(build_model(), text)
File ~/.pyenv/versions/3.10.8/lib/python3.10/site-packages/audioldm/pipeline.py:79, in build_model(ckpt_path, config)
75 latent_diffusion = LatentDiffusion(**config["model"]["params"])
77 resume_from_checkpoint = ckpt_path
---> 79 checkpoint = torch.load(resume_from_checkpoint, map_location=device)
80 latent_diffusion.load_state_dict(checkpoint["state_dict"])
82 latent_diffusion.eval()
File ~/.pyenv/versions/3.10.8/lib/python3.10/site-packages/torch/serialization.py:789, in load(f, map_location, pickle_module, weights_only, **pickle_load_args)
787 except RuntimeError as e:
788 raise pickle.UnpicklingError(UNSAFE_MESSAGE + str(e)) from None
--> 789 return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
790 if weights_only:
791 try:
File ~/.pyenv/versions/3.10.8/lib/python3.10/site-packages/torch/serialization.py:1131, in _load(zip_file, map_location, pickle_module, pickle_file, **pickle_load_args)
1129 unpickler = UnpicklerWrapper(data_file, **pickle_load_args)
1130 unpickler.persistent_load = persistent_load
-> 1131 result = unpickler.load()
1133 torch._utils._validate_loaded_sparse_tensors()
1135 return result
File ~/.pyenv/versions/3.10.8/lib/python3.10/site-packages/torch/serialization.py:1101, in _load.<locals>.persistent_load(saved_id)
1099 if key not in loaded_storages:
1100 nbytes = numel * torch._utils._element_size(dtype)
-> 1101 load_tensor(dtype, nbytes, key, _maybe_decode_ascii(location))
1103 return loaded_storages[key]
File ~/.pyenv/versions/3.10.8/lib/python3.10/site-packages/torch/serialization.py:1079, in _load.<locals>.load_tensor(dtype, numel, key, location)
1076 def load_tensor(dtype, numel, key, location):
1077 name = f'data/{key}'
-> 1079 storage = zip_file.get_storage_from_record(name, numel, torch.UntypedStorage).storage().untyped()
1080 # TODO: Once we decide to break serialization FC, we can
1081 # stop wrapping with TypedStorage
1082 loaded_storages[key] = torch.storage.TypedStorage(
1083 wrap_storage=restore_location(storage, location),
1084 dtype=dtype)
RuntimeError: PytorchStreamReader failed reading file data/11: invalid header or archive is corrupted
@thorwhalen Looks like the checkpoint file is corrupted. May be that's because you have interrupted once when AudioLDM tried to download the checkpoint. Please try to delete the corrupt checkpoint (in most cases at ~/.cache/audioldm/) and try again.
so, would you please post the MD5 value for these released models ?
So I'm having a similar issue in WSL-Ubuntu, did Pip3 install >
Downloading pytorch_model.bin: 100%|██████████████████████████████████████| 501M/501M [00:04<00:00, 104MB/s] Some weights of the model checkpoint at roberta-base were not used when initializing RobertaModel: ['lm_head.layer_norm.bias', 'lm_head.decoder.weight', 'lm_head.bias', 'lm_head.layer_norm.weight', 'lm_head.dense.weight', 'lm_head.dense.bias']
- This IS expected if you are initializing RobertaModel from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).
- This IS NOT expected if you are initializing RobertaModel from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).
Traceback (most recent call last):
File "/home/perplexity/miniconda3/envs/audioldm/bin/audioldm", line 152, in
audioldm = build_model(model_name=args.model_name) File "/home/perplexity/miniconda3/envs/audioldm/lib/python3.8/site-packages/audioldm/pipeline.py", line 85, in build_model checkpoint = torch.load(resume_from_checkpoint, map_location=device) File "/home/perplexity/miniconda3/envs/audioldm/lib/python3.8/site-packages/torch/serialization.py", line 797, in load with _open_zipfile_reader(opened_file) as opened_zipfile: File "/home/perplexity/miniconda3/envs/audioldm/lib/python3.8/site-packages/torch/serialization.py", line 283, in init super().init(torch._C.PyTorchFileReader(name_or_buffer)) RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory
I downloaded the models however (after I stopped the initial one from downloading) and put them into the checkpoints folder. Why does it keep looking for them in cache?