haoheliu / AudioLDM

AudioLDM: Generate speech, sound effects, music and beyond, with text.
https://audioldm.github.io/
Other
2.38k stars 220 forks source link

How to configure for Mac silicon Intel and AMD #89

Open ldjpr opened 1 year ago

ldjpr commented 1 year ago

How can I configure to run in a Intel Mac with AMD GPU?

I get the error: "Torch not compiled with CUDA enabled"

Has anyone been able to run it?

ediooo commented 1 year ago

have the same issue here, did not find a solution unfortunately

On Fri 2. Jun 2023 at 01:58, ldjpr @.***> wrote:

How can I configure to run in a Intel Mac with AMD GPU?

I get the error: "Torch not compiled with CUDA enabled"

Has anyone been able to run it?

— Reply to this email directly, view it on GitHub https://github.com/haoheliu/AudioLDM/issues/89, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHV4JVOEODIKBJ62S576F6LXJEUCHANCNFSM6AAAAAAYXTOU2Y . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- David Kamp I studiokamp.com http://www.studiokamp.com

suckrowPierre commented 1 year ago

I got it running on my M1 using the AudioLDM pipeline from HuggingSpace.

(https://huggingface.co/docs/diffusers/v0.17.1/en/api/pipelines/audioldm)

from diffusers import AudioLDMPipeline
import torch

repo_id = "cvssp/audioldm-m-full"
pipe = AudioLDMPipeline.from_pretrained(repo_id, torch_dtype=torch.float64)
# pipe = pipe.to("cude")
pipe = pipe.to("cpu")

prompt = "mystical, dreamy analog synth strings"
negative_prompt = "low quality, average quality, noisey, high pitch, artefacts"
audio = pipe(prompt=prompt, audio_length_in_s=5.0, num_inference_steps=10, guidance_scale=2.5, negative_prompt=negative_prompt).audios[0]

from IPython.display import Audio
Audio(audio, rate=44100)

with the conda dependencies:

name: audio_env
channels:
  - defaults
dependencies:
  - python=3.11.0
  - pip
  - jupyter
  - pip:
    - torch==2.0.1
    - diffusers
    - transformers
suckrowPierre commented 1 year ago

seems also to work and be a bit faster with pipe = pipe.to("mps")

dzluke commented 1 year ago

@suckrowPierre Thanks for the code and conda env. I tried to use pipe = pipe.to("mps") but got the error TypeError: Cannot convert a MPS Tensor to float64 dtype as the MPS framework doesn't support float64. Please use float32 instead.

Did you run unto this problem at all?