FelippeTN/witcher3-dataset-ptbr
Viewer • Updated • 547 • 14 • 1
How to use tendrivalentin/witcher3-qwen35-08b-sft-ptbr with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="tendrivalentin/witcher3-qwen35-08b-sft-ptbr")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("tendrivalentin/witcher3-qwen35-08b-sft-ptbr")
model = AutoModelForCausalLM.from_pretrained("tendrivalentin/witcher3-qwen35-08b-sft-ptbr", 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 tendrivalentin/witcher3-qwen35-08b-sft-ptbr with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "tendrivalentin/witcher3-qwen35-08b-sft-ptbr"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "tendrivalentin/witcher3-qwen35-08b-sft-ptbr",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/tendrivalentin/witcher3-qwen35-08b-sft-ptbr
How to use tendrivalentin/witcher3-qwen35-08b-sft-ptbr with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "tendrivalentin/witcher3-qwen35-08b-sft-ptbr" \
--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": "tendrivalentin/witcher3-qwen35-08b-sft-ptbr",
"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 "tendrivalentin/witcher3-qwen35-08b-sft-ptbr" \
--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": "tendrivalentin/witcher3-qwen35-08b-sft-ptbr",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use tendrivalentin/witcher3-qwen35-08b-sft-ptbr with Docker Model Runner:
docker model run hf.co/tendrivalentin/witcher3-qwen35-08b-sft-ptbr
Fine-tuned version of Qwen/Qwen3.5-0.8B on the witcher3-dataset-ptbr dataset for Witcher 3 themed conversations in Brazilian Portuguese.
Hugging Face Hub: tendrivalentin/witcher3-qwen35-08b-sft-ptbr
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("tendrivalentin/witcher3-qwen35-08b-sft-ptbr")
tokenizer = AutoTokenizer.from_pretrained("tendrivalentin/witcher3-qwen35-08b-sft-ptbr")
messages = [{"role": "user", "content": "Quem é Ciri e qual é a sua importância?"}]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=150, temperature=0.7, do_sample=True)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
from transformers import AutoModelForCausalLM, AutoTokenizer
model_path = "runs/sft-witcher3-ptbr-qwen35-08b-full"
model = AutoModelForCausalLM.from_pretrained(model_path)
tokenizer = AutoTokenizer.from_pretrained(model_path)
messages = [{"role": "user", "content": "Fale sobre Yennefer."}]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=150, temperature=0.7, do_sample=True)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
| Metric | Value |
|---|---|
| Train Loss | 0.660 |
| Train Accuracy | 85.07% |
| Eval Loss (best) | 2.391 |
| Eval Accuracy | 53.93% |
| Training Time | ~35 min |
| Hardware | Apple Silicon (MPS) |
This model was trained with SFT.
Cite TRL as:
@software{vonwerra2020trl,
title = {{TRL: Transformers Reinforcement Learning}},
author = {von Werra, Leandro and Belkada, Younes and Tunstall, Lewis and Beeching, Edward and Thrush, Tristan and Lambert, Nathan and Huang, Shengyi and Rasul, Kashif and Gallouédec, Quentin},
license = {Apache-2.0},
url = {https://github.com/huggingface/trl},
year = {2020}
}