tsterbak/lyrics-dataset
Viewer • Updated • 158k • 234 • 5
How to use asigalov61/Karaoke-Lyrics-Qwen3-0.6B with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="asigalov61/Karaoke-Lyrics-Qwen3-0.6B")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("asigalov61/Karaoke-Lyrics-Qwen3-0.6B")
model = AutoModelForCausalLM.from_pretrained("asigalov61/Karaoke-Lyrics-Qwen3-0.6B", device_map="auto")
messages = [
{"role": "user", "content": "Who are you?"},
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use asigalov61/Karaoke-Lyrics-Qwen3-0.6B with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "asigalov61/Karaoke-Lyrics-Qwen3-0.6B"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "asigalov61/Karaoke-Lyrics-Qwen3-0.6B",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/asigalov61/Karaoke-Lyrics-Qwen3-0.6B
How to use asigalov61/Karaoke-Lyrics-Qwen3-0.6B with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "asigalov61/Karaoke-Lyrics-Qwen3-0.6B" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "asigalov61/Karaoke-Lyrics-Qwen3-0.6B",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "asigalov61/Karaoke-Lyrics-Qwen3-0.6B" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "asigalov61/Karaoke-Lyrics-Qwen3-0.6B",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use asigalov61/Karaoke-Lyrics-Qwen3-0.6B with Docker Model Runner:
docker model run hf.co/asigalov61/Karaoke-Lyrics-Qwen3-0.6B
from transformers import AutoModelForCausalLM, AutoTokenizer
model_path = "asigalov61/Karaoke-Lyrics-Qwen3-0.6B"
model = AutoModelForCausalLM.from_pretrained(
model_path,
torch_dtype="auto",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
lyrics = "So close no matter how far\nCould not be much more from the heart\nForever trusting who we are\nAnd nothing else matters"
prompt = 'Lyrics template: ' + ' '.join(['_' * len(w) for w in lyrics.split()])
messages = [
{"role": "system", "content": "Please fill in the words in the following song lyrics template and guess song title. Thank you."},
{"role": "user", "content": prompt}
]
chat_text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
enable_thinking=False
)
model_inputs = tokenizer([chat_text], return_tensors="pt").to(model.device)
num_batches = 1
generated_ids = model.generate(
**model_inputs,
max_new_tokens=512,
do_sample=True,
temperature=0.9,
top_p=0.96,
top_k=2,
num_return_sequences=num_batches,
repetition_penalty=1.05
)
output_tokens = [
output_ids[len(input_ids):]
for input_ids, output_ids in zip([model_inputs.input_ids] * num_batches, generated_ids)
]
responses = tokenizer.batch_decode(output_tokens, skip_special_tokens=True)
final_responses = []
for r in responses:
final_responses.append(r.split('\n</think>\n')[-1].strip())
print(final_responses[0])