Instructions to use dthomas84/musicgen-large with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use dthomas84/musicgen-large with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-to-audio", model="dthomas84/musicgen-large")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForTextToWaveform processor = AutoProcessor.from_pretrained("dthomas84/musicgen-large") model = AutoModelForTextToWaveform.from_pretrained("dthomas84/musicgen-large", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update handler.py
Browse files- handler.py +2 -2
handler.py
CHANGED
|
@@ -46,11 +46,11 @@ class EndpointHandler:
|
|
| 46 |
|
| 47 |
if audio is not None and is_existing_audio == False:
|
| 48 |
audio_array = np.array(audio)
|
| 49 |
-
audio = audio_array[: len(audio_array) //
|
| 50 |
# sample["array"] = sample["array"][: len(sample["array"]) // 2]
|
| 51 |
elif audio is not None and is_existing_audio == True:
|
| 52 |
audio_array = np.array(audio)
|
| 53 |
-
audio = audio_array[len(audio_array) //
|
| 54 |
|
| 55 |
if duration is not None:
|
| 56 |
# Calculate max new tokens based on duration, this is a placeholder, replace with actual logic
|
|
|
|
| 46 |
|
| 47 |
if audio is not None and is_existing_audio == False:
|
| 48 |
audio_array = np.array(audio)
|
| 49 |
+
audio = audio_array[: len(audio_array) // 3]
|
| 50 |
# sample["array"] = sample["array"][: len(sample["array"]) // 2]
|
| 51 |
elif audio is not None and is_existing_audio == True:
|
| 52 |
audio_array = np.array(audio)
|
| 53 |
+
audio = audio_array[len(audio_array) // 3:]
|
| 54 |
|
| 55 |
if duration is not None:
|
| 56 |
# Calculate max new tokens based on duration, this is a placeholder, replace with actual logic
|