mirror of
https://github.com/ml-explore/mlx-examples.git
synced 2025-08-30 02:53:41 +08:00
![]() Add timeout handling to various `generate` functions across multiple files. * **cvae/main.py** - Add `timeout` parameter to `generate` function. - Implement timeout handling using `signal` module in `generate` function. * **flux/dreambooth.py** - Add `timeout` parameter to `generate_progress_images` function. - Implement timeout handling using `signal` module in `generate_progress_images` function. * **musicgen/generate.py** - Add `timeout` parameter to `main` function. - Implement timeout handling using `signal` module in `main` function. * **stable_diffusion/txt2image.py** - Add `timeout` parameter to `main` function. - Implement timeout handling using `signal` module in `main` function. * **llava/generate.py** - Add `timeout` parameter to `main` function. - Implement timeout handling using `signal` module in `main` function. * **llms/gguf_llm/generate.py** - Add `timeout` parameter to `generate` function. - Implement timeout handling using `signal` module in `generate` function. * **llms/mlx_lm/generate.py** - Add `timeout` parameter to `main` function. - Implement timeout handling using `signal` module in `main` function. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/jincdream/mlx-examples?shareId=XXXX-XXXX-XXXX-XXXX). |
||
---|---|---|
.. | ||
benchmarks | ||
encodec.py | ||
generate.py | ||
musicgen.py | ||
README.md | ||
requirements.txt | ||
t5.py | ||
utils.py |
MusicGen
An example of Meta's MusicGen model in MLX.1 MusicGen is used to generate music from text descriptions.
Setup
Install the requirements:
pip install -r requirements.txt
Example
An example using the model:
from musicgen import MusicGen
from utils import save_audio
model = MusicGen.from_pretrained("facebook/musicgen-medium")
audio = model.generate("happy rock")
save_audio("out.wav", audio, model.sampling_rate)
-
Refer to the arXiv paper and code for more details. ↩︎