teknium/trismegistus-project
Viewer • Updated • 13.5k • 59 • 77
How to use jtatman/llama-3.2-1b-trismegistus with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="jtatman/llama-3.2-1b-trismegistus")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("jtatman/llama-3.2-1b-trismegistus")
model = AutoModelForCausalLM.from_pretrained("jtatman/llama-3.2-1b-trismegistus")
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 jtatman/llama-3.2-1b-trismegistus with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "jtatman/llama-3.2-1b-trismegistus"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "jtatman/llama-3.2-1b-trismegistus",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/jtatman/llama-3.2-1b-trismegistus
How to use jtatman/llama-3.2-1b-trismegistus with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "jtatman/llama-3.2-1b-trismegistus" \
--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": "jtatman/llama-3.2-1b-trismegistus",
"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 "jtatman/llama-3.2-1b-trismegistus" \
--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": "jtatman/llama-3.2-1b-trismegistus",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use jtatman/llama-3.2-1b-trismegistus with Docker Model Runner:
docker model run hf.co/jtatman/llama-3.2-1b-trismegistus
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 "jtatman/llama-3.2-1b-trismegistus" \
--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": "jtatman/llama-3.2-1b-trismegistus",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'Trismegistus for Llama 3.2 1b. Credits to teknium for dataset and original model.
Llama 3.2 1b
May be biased as hell.
Recommendation:
| Tasks | Version | Filter | n-shot | Metric | Value | Stderr | ||
|---|---|---|---|---|---|---|---|---|
| arc_challenge | 1 | none | 0 | acc | ↑ | 0.3345 | ± | 0.0138 |
| none | 0 | acc_norm | ↑ | 0.3695 | ± | 0.0141 | ||
| arc_easy | 1 | none | 0 | acc | ↑ | 0.6044 | ± | 0.0100 |
| none | 0 | acc_norm | ↑ | 0.5694 | ± | 0.0102 | ||
| boolq | 2 | none | 0 | acc | ↑ | 0.6410 | ± | 0.0084 |
| hellaswag | 1 | none | 0 | acc | ↑ | 0.4400 | ± | 0.0050 |
| none | 0 | acc_norm | ↑ | 0.5728 | ± | 0.0049 | ||
| openbookqa | 1 | none | 0 | acc | ↑ | 0.2260 | ± | 0.0187 |
| none | 0 | acc_norm | ↑ | 0.3540 | ± | 0.0214 | ||
| piqa | 1 | none | 0 | acc | ↑ | 0.7002 | ± | 0.0107 |
| none | 0 | acc_norm | ↑ | 0.7024 | ± | 0.0107 | ||
| winogrande | 1 | none | 0 | acc | ↑ | 0.5785 | ± | 0.0139 |
Will steal your horse and kill your cat.
Install from pip and serve model
# Install SGLang from pip: pip install sglang# Start the SGLang server: python3 -m sglang.launch_server \ --model-path "jtatman/llama-3.2-1b-trismegistus" \ --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": "jtatman/llama-3.2-1b-trismegistus", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'