You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import transformers, torch, builtins, numpy
processor = transformers.AutoProcessor.from_pretrained(' facebook/musicgen-stereo-melody-large', torch_dtype=torch.float16)
model = transformers.MusicgenMelodyForConditionalGeneration.from_pretrained('facebook/musicgen-stereo-melody-large ,torch_dtype=torch.float16).to('cuda')
result = []
for _ in builtins.range(2):
inputs = processor(audio=result[-1] if result else None, sampling_rate=model.config.audio_encoder.sampling_rate, text='A grand and majestic symphony with soaring strings, powerful brass, and dynamic orchestration. Inspired by Beethoven and Tchaikovsky, featuring dramatic crescendos, delicate woodwind passages, and a triumphant finale. The mood is epic, emotional, and timeless', padding=True, return_tensors='pt').to('cuda')
audio_values = model.generate(**inputs, max_new_tokens=1000)
result += audio_values[0, 0].cpu().numpy(),
from IPython.display import Audio
Audio(numpy.concatenate(result), rate=model.config.audio_encoder.sampling_rate)
i always get
<ipython-input-12-348220656bb8> in <cell line: 0>()
7 for _ in builtins.range(2):
8 inputs = processor(audio=torch.from_numpy(result[-1]).to(dtype=torch.float32) if result else None, sampling_rate=model.config.audio_encoder.sampling_rate, text='A grand and majestic symphony with soaring strings, powerful brass, and dynamic orchestration. Inspired by Beethoven and Tchaikovsky, featuring dramatic crescendos, delicate woodwind passages, and a triumphant finale. The mood is epic, emotional, and timeless', padding=True, return_tensors='pt').to('cuda')
----> 9 audio_values = model.generate(**inputs, max_new_tokens=1000)
10 result += audio_values[0, 0].cpu().numpy(),
11
5 frames
/usr/local/lib/python3.11/dist-packages/torch/nn/modules/linear.py in forward(self, input)
123
124 def forward(self, input: Tensor) -> Tensor:
--> 125 return F.linear(input, self.weight, self.bias)
126
127 def extra_repr(self) -> str:
RuntimeError: mat1 and mat2 must have the same dtype, but got Float and Half```
The text was updated successfully, but these errors were encountered:
i always get
The text was updated successfully, but these errors were encountered: