Instructions to use xingjianll/aria-accompaniment with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use xingjianll/aria-accompaniment with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("loubb/aria-medium-base") model = PeftModel.from_pretrained(base_model, "xingjianll/aria-accompaniment") - Transformers
How to use xingjianll/aria-accompaniment with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="xingjianll/aria-accompaniment")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("xingjianll/aria-accompaniment", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use xingjianll/aria-accompaniment with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "xingjianll/aria-accompaniment" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "xingjianll/aria-accompaniment", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/xingjianll/aria-accompaniment
- SGLang
How to use xingjianll/aria-accompaniment 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 "xingjianll/aria-accompaniment" \ --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": "xingjianll/aria-accompaniment", "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 "xingjianll/aria-accompaniment" \ --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": "xingjianll/aria-accompaniment", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use xingjianll/aria-accompaniment with Docker Model Runner:
docker model run hf.co/xingjianll/aria-accompaniment
Model
Model Description
LoRA adapter for accompaniment generation, fine-tuned on ~30,000 (treble-clef, full song) pairs, based on Aria-Medium-Base. try the model here: https://huggingface.co/spaces/xingjianll/symbolic-music-gen
Get Started
tokenizer = AutoTokenizer.from_pretrained(
"loubb/aria-medium-base",
trust_remote_code=True,
add_eos_token=True,
add_dim_token=False,
)
midi_dict = MidiDict.from_midi("input_midi_path")
tokens = tokenizer.tokenize(
midi_dict, add_eos_token=True, add_dim_token=False
)
token_ids = tokenizer._tokenizer.encode(tokens)
input_ids = torch.tensor([token_ids], device='cpu')
model = AutoModelForCausalLM.from_pretrained("loubb/aria-medium-base", trust_remote_code=True)
model = PeftModel.from_pretrained(model, "xingjianll/aria-accompaniment")
continuation = model.generate(
input_ids,
max_length=1600,
do_sample=True,
temperature=1,
top_p=0.95,
use_cache=True
)
midi_dict_output = tokenizer.decode(continuation[0][input_ids.shape[1]:].tolist())
midi_dict_output.to_midi().save("out_midi_path")
- Downloads last month
- 7
Model tree for xingjianll/aria-accompaniment
Base model
loubb/aria-medium-base