huggingface/diffusion-models-class

02_diffusion_for_audio.ipynb encounters an error when running

ZH-UCAS opened this issue · 3 comments

/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_token.py:72: UserWarning:
The secret HF_TOKEN does not exist in your Colab secrets.
To authenticate with the Hugging Face Hub, create a token in your settings tab (https://huggingface.co/settings/tokens), set it as secret in your Google Colab and restart your session.
You will be able to reuse this secret in all of your notebooks.
Please note that authentication is recommended but still optional to access public models or datasets.
warnings.warn(
model_index.json: 100%
244/244 [00:00<00:00, 14.6kB/s]

ValueError Traceback (most recent call last)
in <cell line: 3>()
1 # Load a pre-trained audio diffusion pipeline
2 device = "mps" if torch.backends.mps.is_available() else "cuda" if torch.cuda.is_available() else "cpu"
----> 3 pipe = DiffusionPipeline.from_pretrained("teticio/audio-diffusion-instrumental-hiphop-256").to(device)

3 frames
/usr/local/lib/python3.10/dist-packages/diffusers/pipelines/pipeline_utils.py in download(cls, pretrained_model_name, **kwargs)
1698 custom_components[component] = module_candidate
1699 elif module_candidate not in LOADABLE_CLASSES and not hasattr(pipelines, module_candidate):
-> 1700 raise ValueError(
1701 f"{candidate_file} as defined in model_index.json does not exist in {pretrained_model_name} and is not a module in 'diffusers/pipelines'."
1702 )

ValueError: mel/audio_diffusion.py as defined in model_index.json does not exist in teticio/audio-diffusion-instrumental-hiphop-256 and is not a module in 'diffusers/pipelines'.

use colab
I am a beginner and cannot find the reason. Please help me.

If you try to access a model on the hub that requires you to be logged in, you need to log in. That first error is saying that it can't find your token (HF_TOKEN) in the notebook secrets.
You can find or create a token in https://huggingface.co/settings/tokens and then in the notebook you can log in with

from huggingface_hub import login
login()

and pasting in your token, or by adding it as a secret on Google Colab (which is useful since you may want to do this in many notebooks without having to copy-paste it each time)

The same error occurs after logging in.

Please refer to this issue for reference: deprecated-diffusers
Looks like target diffusers version is 0.24.0 for last audio_diffusion libraries.