Instructions to use Mar2Ding/songcomposer_sft with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Mar2Ding/songcomposer_sft with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Mar2Ding/songcomposer_sft", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Mar2Ding/songcomposer_sft", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Mar2Ding/songcomposer_sft with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Mar2Ding/songcomposer_sft" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Mar2Ding/songcomposer_sft", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Mar2Ding/songcomposer_sft
- SGLang
How to use Mar2Ding/songcomposer_sft 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 "Mar2Ding/songcomposer_sft" \ --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": "Mar2Ding/songcomposer_sft", "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 "Mar2Ding/songcomposer_sft" \ --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": "Mar2Ding/songcomposer_sft", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Mar2Ding/songcomposer_sft with Docker Model Runner:
docker model run hf.co/Mar2Ding/songcomposer_sft
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
pipeline_tag: text-generation
|
|
|
|
|
|
|
|
|
|
| 4 |
---
|
| 5 |
|
| 6 |
|
|
@@ -29,7 +32,7 @@ We release SongComposer series in two versions:
|
|
| 29 |
To load the SongComposer_sft model using Transformers, use the following code:
|
| 30 |
```python
|
| 31 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 32 |
-
ckpt_path = "Mar2Ding/
|
| 33 |
tokenizer = AutoTokenizer.from_pretrained(ckpt_path, trust_remote_code=True)
|
| 34 |
model = AutoModel.from_pretrained(ckpt_path, trust_remote_code=True).cuda().half()
|
| 35 |
prompt = 'Create a song on brave and sacrificing with a rapid pace.'
|
|
@@ -41,7 +44,7 @@ model.inference(prompt, tokenizer)
|
|
| 41 |
|
| 42 |
```python
|
| 43 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 44 |
-
ckpt_path = "Mar2Ding/
|
| 45 |
tokenizer = AutoTokenizer.from_pretrained(ckpt_path, trust_remote_code=True)
|
| 46 |
model = AutoModel.from_pretrained(ckpt_path, trust_remote_code=True).cuda().half()
|
| 47 |
prompt = 'Create a song on brave and sacrificing with a rapid pace.'
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
pipeline_tag: text-generation
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
+
- zh
|
| 7 |
---
|
| 8 |
|
| 9 |
|
|
|
|
| 32 |
To load the SongComposer_sft model using Transformers, use the following code:
|
| 33 |
```python
|
| 34 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 35 |
+
ckpt_path = "Mar2Ding/songcomposer_sft"
|
| 36 |
tokenizer = AutoTokenizer.from_pretrained(ckpt_path, trust_remote_code=True)
|
| 37 |
model = AutoModel.from_pretrained(ckpt_path, trust_remote_code=True).cuda().half()
|
| 38 |
prompt = 'Create a song on brave and sacrificing with a rapid pace.'
|
|
|
|
| 44 |
|
| 45 |
```python
|
| 46 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 47 |
+
ckpt_path = "Mar2Ding/songcomposer_sft"
|
| 48 |
tokenizer = AutoTokenizer.from_pretrained(ckpt_path, trust_remote_code=True)
|
| 49 |
model = AutoModel.from_pretrained(ckpt_path, trust_remote_code=True).cuda().half()
|
| 50 |
prompt = 'Create a song on brave and sacrificing with a rapid pace.'
|