Skip to content

Conversation

@tuxx
Copy link

@tuxx tuxx commented Mar 10, 2025

Hiya,

I got a working Dockerfile that builds the container with GPU support.
Also added github actions to publish the container when a new tag has been pushed.

The resulting docker container URL would be: ghcr.io/haoheliu/AudioLDM/audioldm:latest

What needs to be done

What i can do

What repo maintainer should do

  • Make sure your repository has "Read and write permissions" enabled for workflows (in repository settings under ActionsGeneral) -- (In my forked repo this setting was already enabled)
  • Tag releases like v1.0.0 to build new containers automatically

Running it locally

docker build -t audioldm:gpu .

docker run --gpus all -v $(pwd)/output:/app/output audioldm:gpu --text "spaceship shooting 1 bullet" -dur 2.5 --save_path /app/output

Output (Removed some python futurewarnings, etc for readability):

Load AudioLDM: %s audioldm-m-full
Downloading the main structure of audioldm-m-full into /root/.cache/audioldm
Weights downloaded in: /root/.cache/audioldm/audioldm-m-full.ckpt Size: 4571683377
100% |########################################################################|
DiffusionWrapper has 415.95 M params.
  WeightNorm.apply(module, name, dim)
  warnings.warn(
  fft_window = librosa.util.pad_center(fft_window, n_fft)
  return _VF.meshgrid(tensors, **kwargs)  # type: ignore[attr-defined]
  return torch.load(checkpoint_file, map_location="cpu")
Some weights of the model checkpoint at roberta-base were not used when initializing RobertaModel: ['lm_head.layer_norm.weight', 'lm_head.layer_norm.bias', 'lm_head.bias', 'lm_head.dense.bias', 'lm_head.dense.weight', 'lm_head.decoder.weight']
- 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).
  checkpoint = torch.load(resume_from_checkpoint, map_location=device)
Generate audio using text spaceship shooting 1 bullet
DDIM Sampler: 100%|██████████| 200/200 [00:11<00:00, 17.64it/s]
  warnings.warn(                                                                                                                           
  Save audio to /app/output/generation/10_03_2025_00_17_42_spaceship shooting 1 bullet_0.wav

@tuxx tuxx marked this pull request as ready for review March 10, 2025 01:02
@tuxx tuxx changed the title WIP: Docker support Docker support Mar 10, 2025
@tuxx
Copy link
Author

tuxx commented Mar 10, 2025

Examples with the container from my fork:

Running in CLI mode:
docker run --gpus all -v $(pwd)/output:/app/output ghcr.io/tuxx/audioldm/audioldm:latest --text "spaceship shooting 1 bullet" -dur 2.5 --save_path /app/output

Running webapp:
docker run --gpus all -p 7860:7860 ghcr.io/tuxx/audioldm/audioldm:latest webapp

@tuxx
Copy link
Author

tuxx commented Mar 10, 2025

Waiting on build to fix this:

$ docker run --gpus all -v $(pwd)/output:/app/output ghcr.io/tuxx/audioldm/audioldm:latest --text "spaceship shooting 1 bullet" -dur 2.5 --save_path /app/output

Traceback (most recent call last):
  File "/usr/local/bin/audioldm", line 3, in <module>
    from audioldm import text_to_audio, style_transfer, build_model, save_wave, get_time, round_up_duration, get_duration
  File "/usr/local/lib/python3.8/dist-packages/audioldm/__init__.py", line 1, in <module>
    from .ldm import LatentDiffusion
  File "/usr/local/lib/python3.8/dist-packages/audioldm/ldm.py", line 6, in <module>
    from audioldm.utils import default, instantiate_from_config, save_wave
  File "/usr/local/lib/python3.8/dist-packages/audioldm/utils.py", line 6, in <module>
    import soundfile as sf
ModuleNotFoundError: No module named 'soundfile'
exit status 1

@tuxx
Copy link
Author

tuxx commented Mar 10, 2025

Should work now :)

@tuxx
Copy link
Author

tuxx commented Mar 10, 2025

Got one more issue, when portforwarding the webapp port, i can not access it outside the container. Maybe i should run the app.py on 0.0.0.0 or something? Not sure yet.

@ElanHasson
Copy link

Hi @tuxx, I tried the docker image build locally and get a "This page isn’t working right now
127.0.0.1 didn’t send any data.
ERR_EMPTY_RESPONSE" error.

docker run -it --gpus all -p 7860:7860 docker.io/library/audioldm:gpu webapp

@tuxx
Copy link
Author

tuxx commented Jul 16, 2025

Hi @tuxx, I tried the docker image build locally and get a "This page isn’t working right now 127.0.0.1 didn’t send any data. ERR_EMPTY_RESPONSE" error.

docker run -it --gpus all -p 7860:7860 docker.io/library/audioldm:gpu webapp

I think the app should be running on 0.0.0.0 to make this work. Havent been working on this tho 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants