Instructions to use floriangardin/musiclang with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use floriangardin/musiclang with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="floriangardin/musiclang")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("floriangardin/musiclang") model = AutoModelForCausalLM.from_pretrained("floriangardin/musiclang") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use floriangardin/musiclang with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "floriangardin/musiclang" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "floriangardin/musiclang", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/floriangardin/musiclang
- SGLang
How to use floriangardin/musiclang with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "floriangardin/musiclang" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "floriangardin/musiclang", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "floriangardin/musiclang" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "floriangardin/musiclang", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use floriangardin/musiclang with Docker Model Runner:
docker model run hf.co/floriangardin/musiclang
Musiclang LLM
Check https://github.com/MusicLang/musiclang to use this model in your musical compositions
MusicLang LLM is a language model based on top of the musiclang symbolic tonal music language. Is is used to predict new music from an existing score.
How to use
Install musiclang package in python :
pip install musiclang
Predict some music from a given prompt written with musiclang :
from musiclang.library import *
from musiclang import Score
# Some random bar of chopin op18 Waltz
score = ((V % III.b.M)(
piano__0=s0 + s2.e.mp + s3.e.mp,
piano__4=s0.e.o(-2).p + r.e + s0.ed.o(-1).mp + r.s,
piano__5=r + s4.ed.o(-1).mp + r.s,
piano__6=r + s6.ed.o(-1).mp + r.s)+
(V['7'] % III.b.M)(
piano__0=s2.ed.mp + r.s,
piano__2=s4.ed.mp + r.s,
piano__4=s6.ed.o(-1).mp + r.s,
piano__5=s0.ed.o(-1).mp + r.s,
piano__6=s4.ed.o(-1).mp + r.s))
# Predict the next two chords of the score using huggingface musiclang model
predicted_score = score.predict_score(n_chords=2, temperature=0.5)
# Save it to midi
predicted_score.to_midi('test.mid')
- Downloads last month
- 825