Instructions to use rooroo79/music-spectrogram-diffusion with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use rooroo79/music-spectrogram-diffusion with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("rooroo79/music-spectrogram-diffusion", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Export ModelMixin so encoder from_pretrained can resolve
Browse files
spectrogram_diffusion/__init__.py
CHANGED
|
@@ -1,13 +1,19 @@
|
|
| 1 |
"""Shim for this checkpoint's model_index.json.
|
| 2 |
|
| 3 |
The Google weights name the note/context encoders as library
|
| 4 |
-
`spectrogram_diffusion`
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
"""
|
| 9 |
from __future__ import annotations
|
| 10 |
|
|
|
|
|
|
|
| 11 |
try:
|
| 12 |
from diffusers.pipelines.deprecated.spectrogram_diffusion.continuous_encoder import (
|
| 13 |
SpectrogramContEncoder,
|
|
@@ -23,4 +29,4 @@ except ImportError: # older Diffusers still used the non-deprecated path
|
|
| 23 |
SpectrogramNotesEncoder,
|
| 24 |
)
|
| 25 |
|
| 26 |
-
__all__ = ["SpectrogramContEncoder", "SpectrogramNotesEncoder"]
|
|
|
|
| 1 |
"""Shim for this checkpoint's model_index.json.
|
| 2 |
|
| 3 |
The Google weights name the note/context encoders as library
|
| 4 |
+
`spectrogram_diffusion`. Diffusers' from_pretrained() does:
|
| 5 |
+
|
| 6 |
+
library = importlib.import_module("spectrogram_diffusion")
|
| 7 |
+
class_obj = getattr(library, "SpectrogramContEncoder")
|
| 8 |
+
class_candidates = {name: getattr(library, name, None) for name in LOADABLE_CLASSES}
|
| 9 |
+
|
| 10 |
+
so this module must export both the encoder classes *and* ModelMixin
|
| 11 |
+
(otherwise loading raises: no from_pretrained on the component).
|
| 12 |
"""
|
| 13 |
from __future__ import annotations
|
| 14 |
|
| 15 |
+
from diffusers import ModelMixin
|
| 16 |
+
|
| 17 |
try:
|
| 18 |
from diffusers.pipelines.deprecated.spectrogram_diffusion.continuous_encoder import (
|
| 19 |
SpectrogramContEncoder,
|
|
|
|
| 29 |
SpectrogramNotesEncoder,
|
| 30 |
)
|
| 31 |
|
| 32 |
+
__all__ = ["ModelMixin", "SpectrogramContEncoder", "SpectrogramNotesEncoder"]
|