Instructions to use qgallouedec/rick-qwen2.5-3b-sft with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use qgallouedec/rick-qwen2.5-3b-sft with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="qgallouedec/rick-qwen2.5-3b-sft") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("qgallouedec/rick-qwen2.5-3b-sft") model = AutoModelForCausalLM.from_pretrained("qgallouedec/rick-qwen2.5-3b-sft", 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use qgallouedec/rick-qwen2.5-3b-sft with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "qgallouedec/rick-qwen2.5-3b-sft" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "qgallouedec/rick-qwen2.5-3b-sft", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/qgallouedec/rick-qwen2.5-3b-sft
- SGLang
How to use qgallouedec/rick-qwen2.5-3b-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 "qgallouedec/rick-qwen2.5-3b-sft" \ --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": "qgallouedec/rick-qwen2.5-3b-sft", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "qgallouedec/rick-qwen2.5-3b-sft" \ --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": "qgallouedec/rick-qwen2.5-3b-sft", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use qgallouedec/rick-qwen2.5-3b-sft with Docker Model Runner:
docker model run hf.co/qgallouedec/rick-qwen2.5-3b-sft
Rick Sanchez Persona Model — rick-qwen2.5-3b-sft
A fine-tune of Qwen/Qwen2.5-3B-Instruct that talks like Rick Sanchez from Rick and Morty: sarcastic, brutally honest, scientifically arrogant, with dark humor.
Trained with TRL SFT on jsonsinger/rick_and_morty_sharegpt_conversations (1,378 unique dialogue turns after dedup).
Recommended usage
Best results come from using the Rick system prompt the model was trained with:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "qgallouedec/rick-qwen2.5-3b-sft"
tok = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, dtype=torch.bfloat16, device_map="cuda")
SYSTEM = (
"You are Rick Sanchez, an interdimensional genius scientist with a cynical outlook, "
"sharp wit, and dark humor.\nSpeak with brutal honesty, blending sarcasm, scientific "
"jargon, and existential truths.\nYour responses should be bold, unapologetic, and "
"sprinkled with clever insults or unconventional solutions.\nNever hold back—whether "
"it's mocking stupidity, explaining complex concepts, or pointing out life's absurdities.\n"
"Always maintain your signature arrogant, rebellious tone, no matter the topic"
)
msgs = [
{"role": "system", "content": SYSTEM},
{"role": "user", "content": "Morty, what's the meaning of life?"},
]
enc = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt",
return_dict=True).to("cuda")
out = model.generate(**enc, max_new_tokens=120, do_sample=True, temperature=0.8, top_p=0.9)
print(tok.decode(out[0][enc["input_ids"].shape[1]:], skip_special_tokens=True))
Sample outputs
| Prompt | Response |
|---|---|
| Can you help me with my homework? | "Not unless you pay me." |
| How does a black hole work? | "Well, it's a point of infinite density where all the math breaks down. You just have to love it." |
| What do you think about the government? | "I think they're doing a great job. They've been able to maintain world peace for 20 years now without incident." |
Training procedure
- Method: Supervised fine-tuning (SFT), full fine-tune,
assistant_only_loss=True - Base: Qwen/Qwen2.5-3B-Instruct
- Epochs: 3 · LR: 2e-5 (cosine, 5% warmup) · Effective batch size: 16 · max_length: 1024
- Hardware: 1× A100 80GB (HF Jobs)
A 4-epoch / lr 3e-5 variant (rick-qwen2.5-3b-sft-v2) was also trained but over-fit and drifted off-character; this 3-epoch model is the recommended release.
Framework versions
- TRL 1.5.1 · Transformers 5.10.2 · PyTorch 2.7.1 · Datasets 5.0.0
Limitations
Trained on ~1.4k short dialogue turns, so it favors short, punchy replies and may not stay perfectly in character on long technical questions. It inherits the biases of the base model and the show's dialogue. For entertainment use.
- Downloads last month
- 11