Text-to-Audio
Diffusers
Safetensors
PyTorch
minimax_music3
music-generation
text-to-music
sglang-omni
Instructions to use MiniMaxAI/MiniMax-Music3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use MiniMaxAI/MiniMax-Music3 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("MiniMaxAI/MiniMax-Music3", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Update scripts/end_to_end/minimax_ttm_test.py
#29
by Vitalur - opened
scripts/end_to_end/minimax_ttm_test.py
CHANGED
|
@@ -10,102 +10,49 @@ import urllib.request
|
|
| 10 |
from pathlib import Path
|
| 11 |
|
| 12 |
CAPTION = """Global Metadata
|
| 13 |
-
Basic Attributes:
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
Let love lift what used to fall—
|
| 57 |
-
breathe a little deeper, yeah.
|
| 58 |
-
[bass-quartet-rumbles-in]
|
| 59 |
-
Every heartbeat sounded like,
|
| 60 |
-
“We shall overcome, Daddy…
|
| 61 |
-
let’s heal what once was numb.”
|
| 62 |
-
And the joy outran the fear,
|
| 63 |
-
washed away the hurt and pain—
|
| 64 |
-
[pre-chorus]
|
| 65 |
-
Breathe a little deeper,
|
| 66 |
-
love is here to heal.
|
| 67 |
-
Breathe a little deeper,
|
| 68 |
-
love is here to heal.
|
| 69 |
-
Love is here to heal,
|
| 70 |
-
let love lift what used to fall…
|
| 71 |
-
Breathe a little deeper,
|
| 72 |
-
love is here to heal.
|
| 73 |
-
Love is here to heal,
|
| 74 |
-
love is here to heal.
|
| 75 |
-
[bridge]
|
| 76 |
-
Every time I see you wiggling there,
|
| 77 |
-
I’m reminded again and again.
|
| 78 |
-
What keeps playing on repeat
|
| 79 |
-
in my spirit, in my mind,
|
| 80 |
-
is the sound of your heartbeat…
|
| 81 |
-
and I can’t wait to hold you next to mine.
|
| 82 |
-
[interlude]
|
| 83 |
-
You gotta let love— (Oh love… lift us up…)
|
| 84 |
-
Love Lift us up higher—-
|
| 85 |
-
(oh my sweet little Princess Ever Don’t EVER ever ever fear the things you might not yet understand about yourself or father and mother or this world)—
|
| 86 |
-
As long as you let love— Oh love—
|
| 87 |
-
Continue DOing all your heavy lifting Ever-Michelle
|
| 88 |
-
nothing else matters
|
| 89 |
-
when you let love— oh love—
|
| 90 |
-
lift whatever fell or falls…
|
| 91 |
-
[chorus]
|
| 92 |
-
You gotta let love— oh love—Let love—-oh love—-
|
| 93 |
-
Lift what used to fall…
|
| 94 |
-
You gotta let love— oh love—Let love—-oh love—-
|
| 95 |
-
Lift what used to fall…
|
| 96 |
-
You gotta let love— oh love—Let love—-oh love—-
|
| 97 |
-
Lift what used to fall…
|
| 98 |
-
[outro]
|
| 99 |
-
We’re gonna let love stay,
|
| 100 |
-
let our vows endure.
|
| 101 |
-
Oh love… stay… stay…
|
| 102 |
-
We’re gonna let love stay,
|
| 103 |
-
’cause this home is built with love.
|
| 104 |
-
Oh love… stay… stay…
|
| 105 |
-
We’re gonna let love stay,
|
| 106 |
-
let our vows endure—
|
| 107 |
-
this home is made with love,
|
| 108 |
-
and love is here to stay."""
|
| 109 |
|
| 110 |
|
| 111 |
DEFAULT_OUT = Path("minimax_ttm.wav")
|
|
|
|
| 10 |
from pathlib import Path
|
| 11 |
|
| 12 |
CAPTION = """Global Metadata
|
| 13 |
+
Basic Attributes:import time
|
| 14 |
+
import numpy as np
|
| 15 |
+
BPM = 122
|
| 16 |
+
BEAT_DURATION = 60.0 / BPM
|
| 17 |
+
SAMPLE_RATE = 44100
|
| 18 |
+
# (F minor)
|
| 19 |
+
# Fm -> Ab -> Db -> Eb
|
| 20 |
+
CHORDS = {
|
| 21 |
+
'Fm': [174.61, 207.65, 261.63], # F3, Ab3, C4
|
| 22 |
+
'Ab': [207.65, 261.63, 311.13], # Ab3, C4, Eb4
|
| 23 |
+
'Db': [138.59, 174.61, 220.00], # Db3, F3, Ab3
|
| 24 |
+
'Eb': [155.56, 196.00, 233.08] # Eb3, G3, Bb3
|
| 25 |
+
}
|
| 26 |
+
BASS_NOTES = [87.31, 103.83, 69.30, 77.78] # F2, Ab2, Db2, Eb2
|
| 27 |
+
|
| 28 |
+
def generate_sine_wave(freq, duration, volume=0.5)
|
| 29 |
+
t = np.linspace(0, duration, int(SAMPLE_RATE * duration), False)
|
| 30 |
+
envelope = np.sin(np.linspace(0, np.pi, len(t)))
|
| 31 |
+
wave = np.sin(2 * np.pi * freq * t) * envelope * volume
|
| 32 |
+
return wave
|
| 33 |
+
|
| 34 |
+
def play_innerbloom_loop():
|
| 35 |
+
print(f"🎵 Innerbloom ({BPM} BPM)...")
|
| 36 |
+
chord_sequence = ['Fm', 'Ab', 'Db', 'Eb']
|
| 37 |
+
|
| 38 |
+
for idx, chord_name in enumerate(chord_sequence):
|
| 39 |
+
print(f"->: {chord_name} {BASS_NOTES[idx]} Гц")
|
| 40 |
+
bass_wave = generate_sine_wave(BASS_NOTES[idx], BEAT_DURATION * 4, volume=0.7)
|
| 41 |
+
chord_frequencies = CHORDS[chord_name]
|
| 42 |
+
pad_wave = np.zeros_like(bass_wave)
|
| 43 |
+
for freq in chord_frequencies:
|
| 44 |
+
pad_wave += generate_sine_wave(freq, BEAT_DURATION * 4, volume=0.3)
|
| 45 |
+
mixed_track = bass_wave + pad_wave
|
| 46 |
+
(Four-on-the-floor)
|
| 47 |
+
for beat in range(4):
|
| 48 |
+
time.sleep(BEAT_DURATION)
|
| 49 |
+
|
| 50 |
+
if __name__ == "__main__"
|
| 51 |
+
while True:
|
| 52 |
+
play_innerbloom_loop()
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
|
| 58 |
DEFAULT_OUT = Path("minimax_ttm.wav")
|