roskosmos19/Rhea-Coding
Viewer • Updated • 9 • 13 • 1
How to use roskosmos19/Rhea-4B-fast-0409-high with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="roskosmos19/Rhea-4B-fast-0409-high")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("roskosmos19/Rhea-4B-fast-0409-high")
model = AutoModelForCausalLM.from_pretrained("roskosmos19/Rhea-4B-fast-0409-high", 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 roskosmos19/Rhea-4B-fast-0409-high with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "roskosmos19/Rhea-4B-fast-0409-high"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "roskosmos19/Rhea-4B-fast-0409-high",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/roskosmos19/Rhea-4B-fast-0409-high
How to use roskosmos19/Rhea-4B-fast-0409-high with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "roskosmos19/Rhea-4B-fast-0409-high" \
--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": "roskosmos19/Rhea-4B-fast-0409-high",
"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 "roskosmos19/Rhea-4B-fast-0409-high" \
--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": "roskosmos19/Rhea-4B-fast-0409-high",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use roskosmos19/Rhea-4B-fast-0409-high with Docker Model Runner:
docker model run hf.co/roskosmos19/Rhea-4B-fast-0409-high
Faster • Cheaper • Stronger for agentic & coding tasks
Optimized successor of the original Rhea-4B-Coding / Athenea line.
| Aspect | Original multi-pass Rhea | Rhea-4B-Agentic (this) |
|---|---|---|
| Reasoning style | Forced 3-pass (implement→review→final) | Single-pass + optional <think> |
| Context | 262k | 32 768 (covers real agent workloads) |
| Forced long outputs | min_new_tokens=1024 | Removed – answers as long as needed |
| Special tokens | Broken prefixes + many vision | Clean + lean (tools + thinking only) |
| Generation defaults | High temp / long forced | Tuned 0.4 / 0.9 for quality + speed |
| Agentic readiness | Good | Improved tool-calling template |
| Inference cost (VRAM/time) | Higher (long forced reasoning) | Significantly lower |
→ Same 4B base intelligence, noticeably faster and cheaper to run, better real-world agentic behavior because it is no longer forced into three full generations.
<think>...</think> for chain-of-thought (optional, model decides when useful)<|im_start|>, <|im_end|>, <think>, </think>, tool tags{
"temperature": 0.4,
"top_p": 0.9,
"top_k": 30,
"repetition_penalty": 1.05,
"max_new_tokens": 8192
}
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "./Rhea-4B-Agentic"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto"
)
messages = [
{"role": "user", "content": "Write a secure Python function that validates JWT tokens and handles expiration gracefully."}
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer([text], return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=2048)
print(tokenizer.decode(outputs[0][len(inputs.input_ids[0]):], skip_special_tokens=False))
--max-model-len 32768Apache 2.0