Repository: huggingface/diffusers

Issue:
Text to audio with default code produces an unplayable file
### Describe the bug

Great with the new Text to audio feature. However, when I use the default script, the resulting file doesn't contain any audio, there are no errors printed in the console: 

The file properties looks ok:
![image](https://user-images.githubusercontent.com/1322593/231726379-5d14fbee-2b80-49f0-925c-6685505df2a5.png)

However, VLC can't ID the codec:
![image](https://user-images.githubusercontent.com/1322593/231726505-6a99a748-fca6-46c7-b67b-8d42c13bdd42.png)

Here's the file:
[Techno music with a strong_ upbeat tempo and high melodic riffs.zip](https://github.com/huggingface/diffusers/files/11220883/Techno.music.with.a.strong_.upbeat.tempo.and.high.melodic.riffs.zip)


### Reproduction

Just run the default script and check the resulting file. 

### Logs

```shell
No info in logs.
```


### System Info

Diffusers 0.15
PyTorch 2.0.0
Win 11



Discussion:
Hey @tin2tin,

Sorry could you copy-paste the exact command you ran? I'm not 100% sure what model and what code you used? I assume it's https://huggingface.co/cvssp/audioldm
It's the code from here: https://github.com/huggingface/diffusers/releases/tag/v0.15.0

```
from diffusers import AudioLDMPipeline
import torch

repo_id = "cvssp/audioldm"
pipe = AudioLDMPipeline.from_pretrained(repo_id, torch_dtype=torch.float16)
pipe = pipe.to("cuda")

prompt = "Techno music with a strong, upbeat tempo and high melodic riffs"
audio = pipe(prompt, num_inference_steps=10, audio_length_in_s=5.0).audios[0]

import scipy

scipy.io.wavfile.write("techno.wav", rate=16000, data=audio)
```
@sanchit-gandhi Could you check if this is working for you? Could the error be on my end?
I got a same error. Could you guide me on how to resolve it? I tested it with original AudioLDM code and it worked fine. 
> It's the code from here: [`v0.15.0` (release)](https://github.com/huggingface/diffusers/releases/tag/v0.15.0)
> 
> ```
> from diffusers import AudioLDMPipeline
> import torch
> 
> repo_id = "cvssp/audioldm"
> pipe = AudioLDMPipeline.from_pretrained(repo_id, torch_dtype=torch.float16)
> pipe = pipe.to("cuda")
> 
> prompt = "Techno music with a strong, upbeat tempo and high melodic riffs"
> audio = pipe(prompt, num_inference_steps=10, audio_length_in_s=5.0).audios[0]
> 
> import scipy
> 
> scipy.io.wavfile.write("techno.wav", rate=16000, data=audio)
> ```

Remove the `torch_dtype=torch.float16` param, and it seems to work

@devxpy Yes, you're right. That solves the problem. So, the documentation needs to be updated. 

Resolving patch:
diff --git a/src/diffusers/pipelines/audioldm/pipeline_audioldm.py b/src/diffusers/pipelines/audioldm/pipeline_audioldm.py
--- a/src/diffusers/pipelines/audioldm/pipeline_audioldm.py
+++ b/src/diffusers/pipelines/audioldm/pipeline_audioldm.py
@@ -293,7 +293,7 @@ def mel_spectrogram_to_waveform(self, mel_spectrogram):
 
         waveform = self.vocoder(mel_spectrogram)
         # we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16
-        waveform = waveform.cpu()
+        waveform = waveform.cpu().float()
         return waveform
 
     # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.prepare_extra_step_kwargs


Test patch: