AMAAI-Lab / mustango

Mustango: Toward Controllable Text-to-Music Generation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Error] ImportError: cannot import name 'UNet2DConditionModelMusic' from 'diffusers'

syddharth opened this issue · comments

One gets the following error on executing the Quickstart code.

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
[d:\ai-stuff\T2A\mustango\01.ipynb](file:///D:/ai-stuff/T2A/mustango/01.ipynb) Cell 1 line 3
      [1](vscode-notebook-cell:/d%3A/ai-stuff/T2A/mustango/01.ipynb#W1sZmlsZQ%3D%3D?line=0) import IPython
      [2](vscode-notebook-cell:/d%3A/ai-stuff/T2A/mustango/01.ipynb#W1sZmlsZQ%3D%3D?line=1) import soundfile as sf
----> [3](vscode-notebook-cell:/d%3A/ai-stuff/T2A/mustango/01.ipynb#W1sZmlsZQ%3D%3D?line=2) from mustango import Mustango
      [5](vscode-notebook-cell:/d%3A/ai-stuff/T2A/mustango/01.ipynb#W1sZmlsZQ%3D%3D?line=4) model = Mustango("declare-lab/mustango")

File [d:\ai-stuff\T2A\mustango\mustango.py:12](file:///D:/ai-stuff/T2A/mustango/mustango.py:12)
      [9](file:///D:/ai-stuff/T2A/mustango/mustango.py:9) from modelling_deberta_v2 import DebertaV2ForTokenClassificationRegression
     [11](file:///D:/ai-stuff/T2A/mustango/mustango.py:11) from diffusers import DDPMScheduler
---> [12](file:///D:/ai-stuff/T2A/mustango/mustango.py:12) from models import MusicAudioDiffusion
     [15](file:///D:/ai-stuff/T2A/mustango/mustango.py:15) class MusicFeaturePredictor:
     [16](file:///D:/ai-stuff/T2A/mustango/mustango.py:16)     def __init__(self, path, device="cuda:0", cache_dir=None, local_files_only=False):

File [d:\ai-stuff\T2A\mustango\models.py:24](file:///D:/ai-stuff/T2A/mustango/models.py:24)
     [22](file:///D:/ai-stuff/T2A/mustango/models.py:22) from diffusers.utils.torch_utils import randn_tensor
     [23](file:///D:/ai-stuff/T2A/mustango/models.py:23) # from diffusers.utils import randn_tensor
---> [24](file:///D:/ai-stuff/T2A/mustango/models.py:24) from diffusers import DDPMScheduler, UNet2DConditionModel, UNet2DConditionModelMusic
     [25](file:///D:/ai-stuff/T2A/mustango/models.py:25) from diffusers import AutoencoderKL as DiffuserAutoencoderKL
     [26](file:///D:/ai-stuff/T2A/mustango/models.py:26) from layers.layers import chord_tokenizer, beat_tokenizer, Chord_Embedding, Beat_Embedding, Music_PositionalEncoding, Fundamental_Music_Embedding

ImportError: cannot import name 'UNet2DConditionModelMusic' from 'diffusers' (d:\ai-stuff\T2A\mustango\venv\lib\site-packages\diffusers\__init__.py)

We have provided the UNet2DConditionModelMusic implementation in the diffusers directory.
After cloning the repo, you can try:

cd diffusers
pip install -e .

to install diffusers. Then you should be able to import the class and run the quickstart code.

Please follow the steps here for installation: https://github.com/AMAAI-Lab/mustango#installation

just a suggestion: could write a setup.py for the project. This could help in publishing the project as a package on PyPI.