itsrishub/synthetic-logs
Viewer • Updated • 300k • 127 • 2
How to use itsrishub/sawyer-0.5b with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="itsrishub/sawyer-0.5b")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("itsrishub/sawyer-0.5b")
model = AutoModelForCausalLM.from_pretrained("itsrishub/sawyer-0.5b", 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 itsrishub/sawyer-0.5b with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "itsrishub/sawyer-0.5b"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "itsrishub/sawyer-0.5b",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/itsrishub/sawyer-0.5b
How to use itsrishub/sawyer-0.5b with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "itsrishub/sawyer-0.5b" \
--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": "itsrishub/sawyer-0.5b",
"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 "itsrishub/sawyer-0.5b" \
--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": "itsrishub/sawyer-0.5b",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use itsrishub/sawyer-0.5b with Docker Model Runner:
docker model run hf.co/itsrishub/sawyer-0.5b
This model is a fine-tuned version of unsloth/Qwen2.5-0.5B-Instruct. It has been trained using TRL.
from transformers import pipeline
raw_log = """
1786365958491 INFO [paloalto] PAN threat src=dd39:9d89:6b0a:3f8e:f672:dd84:e6fd:28e2 dst=10.0.0.240 app=edge-cache action=drop severity=info\n host=pa-03.prod.us-west-2\n src_ip=128.132.120.128
"""
prompt = f"""### Task
Parse the following log into canonical JSON.
### Log
{raw_log}
### JSON
"""
generator = pipeline("text-generation", model="itsrishub/sawyer-0.5b", device="cuda")
output = generator([{"role": "user", "content": prompt}], max_new_tokens=128, return_full_text=False)[0]
print(output["generated_text"])
This model was trained with SFT.
Cite TRL as:
@misc{vonwerra2022trl,
title = {{TRL: Transformer Reinforcement Learning}},
author = {Leandro von Werra and Younes Belkada and Lewis Tunstall and Edward Beeching and Tristan Thrush and Nathan Lambert and Shengyi Huang and Kashif Rasul and Quentin Gallou{\'e}dec},
year = 2020,
journal = {GitHub repository},
publisher = {GitHub},
howpublished = {\url{https://github.com/huggingface/trl}}
}
Base model
Qwen/Qwen2.5-0.5B