how do you run this? solved, you're welcome.

#29
by Assbang - opened

Honestly i find running meta's music gen simple does higher then the rumoured 47 seconds, but is horrendous at trainning, its so convoluted with dora its pretty much designed that way:

HERES A EXAMPLE INSTALLING META'S MUSIC GEN, CAN BE UP AND RUNNING IN 10 MINUTES.
must be 3.10.11 python
VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV COPY AND PASTE IT
git clone https://github.com/facebookresearch/audiocraft.git to cmd header
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
cd audiocraft

python -m venv venv
cd venv
cd scripts
activate
pip3 install torch==2.0.1 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
cd
cd
pip install -e .

pip uninstall -y xformers
pip install xformers
pip install gradio

pip install einops

pip install audiocraft

call .\venv\Scripts\activate.bat
python .\demos\musicgen_app.py --inbrowser

call .\venv\Scripts\activate.bat
python.pp.py

DONE.

I'm perplexed why STABLE AUDIO requires or requests a token key, and no directory on where to stall the weights.

Update: to install stable audio 1.0, since the information here's useless on hugging face, seems to be a trend.

requirements:
3.8.10
Requires PyTorch 2.0 or later for Flash Attention support, im not using flash, no idea why, anyways who cares.
[next]
git clone https://github.com/Stability-AI/stable-audio-tools.git -> type into your windows box example: Z:\Aistudio_pipeline\ or what ever yours is called, c drive, (YOUR SEARCH BOX, WHERE YOU LOOK FOR YOUR DAM FOLDERS, GAMES ANYTHING, C: ECT. C:\ProgramData point being type cmd into the box and a command window will appear, a folder called stable audio will be created, you can create a:

(add to cmd)
python -m venv venv
cd venv
cd scripts
activate

into the same command cmd, and it will be created, to work in a virtual python environment, exit out of cmd, and search for venv->scripts and type into the header cmd, then type activate: anything you install from here is essentially virtualized, install python 3.10, and install it, that will be determined on your platform os. but for windows install it via the microsoft store, as being the easiest.

(add to cmd)
pip install stable-audio-tools, depending on your environment variables the python prompt can vary, it can be:
pip install stable-audio-tools
python pip install stable-audio-tools
python install stable-audio-tools

but for me it was python install stable-audio-tools
next you'll need to use in the main folder directory of stable audio:

(add to cmd)
pip install .
[next]
huggingface-cli login
add your token key, if you see nothing just hit enter.
[next]
next you will need to download the model.tensor, and the json model file,

Next you'll need to add a folder called ckpt in the main directory where run gradio.py is.

next you'll run either in the venv activate, or the main directory:

python run_gradio.py --ckpt-path ".\ckpt\model.safetensors" --model-config ".\ckpt\model_config.json"

And you should have stable 1.0 up and running.

Now you have meta and stable ai now.

You are fkn welcome.

Will update how to train the ffn model, hopefully that's not as convoluted as meta's ass dora the explorer.

ONCE ITS RUNNING COPY:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@echo off

REM Set the Python command to run the script with arguments
set PYTHON_CMD=python run_gradio.py --ckpt-path ".\ckpt\model.safetensors" --model-config ".\ckpt\model_config.json"

REM Move the model to the appropriate device (GPU or CPU)
REM This should be handled in your Python script, not here in the batch file

REM Environment variable for TensorFlow
REM set TF_ENABLE_ONEDNN_OPTS=0

REM Call the command to run the Python script
%PYTHON_CMD%

REM If you need to call another batch file after running the Python script
call webui.bat
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
into a folder created called run.bat, then save in notepad make sure the extensions .bat, and hit the run.bat file(you can call it what ever you want, ass,) and you will not need to copy in this python run_gradio.py --ckpt-path ".\ckpt\model.safetensors" --model-config ".\ckpt\model_config.json"
all the time, totally optional.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
It was modified from from a bat file used stable diffusion, example:

@echo off
set PYTHON=
set GIT=
set VENV_DIR=
set COMMANDLINE_ARGS= --api --autolaunch --xformers --reinstall-xformers

Move the model to the appropriate device (GPU or CPU)

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device)"
set TF_ENABLE_ONEDNN_OPTS=0
call webui.bat

Assbang changed discussion title from how do you run this? to how do you run this? solved, you are welcome.
Assbang changed discussion title from how do you run this? solved, you are welcome. to how do you run this? solved, you're welcome.

Hey! Coincidentally I just happened to be wanting to look into this. I'll follow your steps and jot down any notes or feedback.

I'm running Python 3.11.6 on Mac OS Sonoma. Only jotting down substantive differences from your notes.

I recommend running huggingface-cli whoami before the login, because you may (as I am) already be logged in.

I did have to fill out the form

image.png

associating the argeement with my HF ID. Then I did:

huggingface-cli download stabilityai/stable-audio-open-1.0

On my mac (and I suspect most UNIX-like machines) the download will go to the HF cache: ~/.cache/huggingface/hub/models--stabilityai--stable-audio-open-1.0

I did have to download libsndfile_arm64.dylib, which someone has built. Of course that's non-paranoid behaviour, and some will understandably refuse to do this. I might look into a guide to building it for myself on Mac (and no, I don't use homebrew, MacPorts, or any of that!). I used a soft link to make it available under the site-packages (i.e. python -c 'import site; print(site.getsitepackages()[0])') at _soundfile_data/libsndfile.dylib.

Of course Apple's security layer didn't like using the download.

image.png

That came from running Gradio as follows:

python ./run_gradio.py --pretrained-name stabilityai/stable-audio-open-1.0

I went to settings for the override.

image.png

Looking good at this point, after navigating to the gradio URL. I did get the flash_attn not installed, disabling Flash Attention warning while generating. Also saw:

~/.local/venv/temp/lib/python3.11/site-packages/torch/amp/autocast_mode.py:250: UserWarning: User provided device_type of 'cuda', but CUDA is not available. Disabling

I might look into running via MLX so that I don't have to deal with CPU speed. Also, a warning that seemed more about prompt engineering:

~/.local/venv/temp/lib/python3.11/site-packages/torchaudio/functional/functional.py:584: UserWarning: At least one mel filterbank has all zero values. The value for `n_mels` (128) may be set too high. Or, the value for `n_freqs` (513) may be set too low.

Initial results are nothing to write home about, except for the mind-boggling fact that I'm creating AI generated music on my laptop from simple text descriptions!

Sign up or log in to comment