Instructions to use fesalfayed/gpt-oss-20b-hermes_agent-tool-finetune_4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use fesalfayed/gpt-oss-20b-hermes_agent-tool-finetune_4bit with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="fesalfayed/gpt-oss-20b-hermes_agent-tool-finetune_4bit") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("fesalfayed/gpt-oss-20b-hermes_agent-tool-finetune_4bit") model = AutoModelForCausalLM.from_pretrained("fesalfayed/gpt-oss-20b-hermes_agent-tool-finetune_4bit") 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
- vLLM
How to use fesalfayed/gpt-oss-20b-hermes_agent-tool-finetune_4bit with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "fesalfayed/gpt-oss-20b-hermes_agent-tool-finetune_4bit" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "fesalfayed/gpt-oss-20b-hermes_agent-tool-finetune_4bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/fesalfayed/gpt-oss-20b-hermes_agent-tool-finetune_4bit
- SGLang
How to use fesalfayed/gpt-oss-20b-hermes_agent-tool-finetune_4bit 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 "fesalfayed/gpt-oss-20b-hermes_agent-tool-finetune_4bit" \ --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": "fesalfayed/gpt-oss-20b-hermes_agent-tool-finetune_4bit", "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 "fesalfayed/gpt-oss-20b-hermes_agent-tool-finetune_4bit" \ --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": "fesalfayed/gpt-oss-20b-hermes_agent-tool-finetune_4bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio new
How to use fesalfayed/gpt-oss-20b-hermes_agent-tool-finetune_4bit with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for fesalfayed/gpt-oss-20b-hermes_agent-tool-finetune_4bit to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for fesalfayed/gpt-oss-20b-hermes_agent-tool-finetune_4bit to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for fesalfayed/gpt-oss-20b-hermes_agent-tool-finetune_4bit to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="fesalfayed/gpt-oss-20b-hermes_agent-tool-finetune_4bit", max_seq_length=2048, ) - Docker Model Runner
How to use fesalfayed/gpt-oss-20b-hermes_agent-tool-finetune_4bit with Docker Model Runner:
docker model run hf.co/fesalfayed/gpt-oss-20b-hermes_agent-tool-finetune_4bit
gpt-oss-20b · Hermes-Agent tool finetune · MXFP4
4-bit MXFP4 quantization of the BF16 checkpoint. Fits in 16 GB of VRAM, runs on a Colab T4, keeps the full 8k context.
- Format — Safetensors, MXFP4
- Size on disk — ~12 GB
- VRAM (inference) — ~14-16 GB
- Recommended runtime — Unsloth, Transformers + bitsandbytes
What this is
A tool-use finetune of OpenAI's gpt-oss-20b for Hermes-Agent,
a local agent framework that needs models which call tools reliably, follow
multi-turn instructions, and don't argue with system prompts.
The base model is the 21B-parameter (3.6B active) Mixture-of-Experts release from OpenAI. This finetune preserves the Harmony chat template and the reasoning-effort knob, and improves:
- Function-calling adherence (correct JSON, no commentary mid-call)
- Long agent loops (10+ turns of tool → observe → plan)
- System-prompt fidelity (respects role boundaries and refusal/allow-list rules)
It is not affiliated with NousResearch's Hermes model series. "Hermes-Agent" here refers to the local agent framework only.
Quickstart
Unsloth (recommended)
from unsloth import FastLanguageModel
model, tok = FastLanguageModel.from_pretrained(
"fesalfayed/gpt-oss-20b-hermes_agent-tool-finetune_4bit",
max_seq_length=8192,
load_in_4bit=True,
)
FastLanguageModel.for_inference(model)
Transformers
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
import torch
tok = AutoTokenizer.from_pretrained("fesalfayed/gpt-oss-20b-hermes_agent-tool-finetune_4bit")
model = AutoModelForCausalLM.from_pretrained(
"fesalfayed/gpt-oss-20b-hermes_agent-tool-finetune_4bit",
quantization_config=BitsAndBytesConfig(load_in_4bit=True,
bnb_4bit_compute_dtype=torch.bfloat16,
bnb_4bit_quant_type="nf4"),
device_map="auto",
)
Hermes-Agent integration
Add a profile in ~/.hermes/config.yaml:
profiles:
gpt-oss-20b-tools:
provider: openai
base_url: http://127.0.0.1:1234/v1 # LM Studio / vLLM / mlx_lm.server
model: fesalfayed/gpt-oss-20b-hermes_agent-tool-finetune_4bit
temperature: 0.7
top_p: 0.95
min_p: 0.1 # important for MoE stability
max_tokens: 8192
tool_choice: auto
Then hermes profile use gpt-oss-20b-tools and the agent loop will route
tool calls through this model.
Sampling
| Param | Value | Why |
|---|---|---|
| temperature | 0.7 | balanced; drop to 0.2 for strict tool calls |
| top_p | 0.95 | standard nucleus |
| min_p | 0.1 | required for MoE — prevents dead-expert tokens |
| repetition_penalty | 1.0 | the model handles repetition itself |
Harmony reasoning effort: set the system message to Reasoning: low|medium|high.
high is roughly 3-4x more output tokens but noticeably better on multi-step
tool plans.
Training
- Base:
openai/gpt-oss-20b - Method: LoRA SFT (rank 64, alpha 16) merged back into BF16
- Frame: Unsloth + TRL on a single H100 (80 GB)
- Data: ~42k tool-use traces from Hermes-Agent sessions, filtered for successful tool calls and clean JSON. No synthetic distillation.
- Length: 8192 tokens, packing on
- Loss: assistant-only, mask user/system/tool
The _16bit repo holds the merged BF16 weights. The _4bit, _mlx, and
_gguf repos are quantizations of that checkpoint.
Limitations
- Math and code-generation are unchanged from the base — this finetune optimizes the agent loop, not raw reasoning.
- The model can over-call tools when given vague instructions. Add a "if you can answer directly, do so" line to the system prompt.
- English only. Other languages were not in the training mix.
- Not safety-tuned beyond what
gpt-oss-20balready provides.
Other formats
- BF16 reference — full precision, vLLM / Transformers
- MXFP4 4-bit — fits a 16 GB GPU
- MLX — Apple Silicon native
- GGUF — llama.cpp / Ollama / LM Studio
License
Apache-2.0, inherited from the base model. No additional restrictions.
Citation
@misc{fesalfayed_gptoss20b_hermesagent_2025,
author = {Fayed, Fesal},
title = {gpt-oss-20b Hermes-Agent tool finetune (4bit)},
year = {2025},
url = {https://huggingface.co/fesalfayed/gpt-oss-20b-hermes_agent-tool-finetune_4bit},
}
- Downloads last month
- 194
Model tree for fesalfayed/gpt-oss-20b-hermes_agent-tool-finetune_4bit
Base model
openai/gpt-oss-20b