Text Generation
Transformers
Safetensors
GGUF
qwen2
axon
ranger
reasoning
math
code
uncensored
conversational
text-generation-inference
Instructions to use axonlabsai/Ranger-7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use axonlabsai/Ranger-7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="axonlabsai/Ranger-7B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("axonlabsai/Ranger-7B") model = AutoModelForCausalLM.from_pretrained("axonlabsai/Ranger-7B", 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
- llama.cpp
How to use axonlabsai/Ranger-7B with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf axonlabsai/Ranger-7B:Q4_K_M # Run inference directly in the terminal: llama cli -hf axonlabsai/Ranger-7B:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf axonlabsai/Ranger-7B:Q4_K_M # Run inference directly in the terminal: llama cli -hf axonlabsai/Ranger-7B:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf axonlabsai/Ranger-7B:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf axonlabsai/Ranger-7B:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf axonlabsai/Ranger-7B:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf axonlabsai/Ranger-7B:Q4_K_M
Use Docker
docker model run hf.co/axonlabsai/Ranger-7B:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use axonlabsai/Ranger-7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "axonlabsai/Ranger-7B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "axonlabsai/Ranger-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/axonlabsai/Ranger-7B:Q4_K_M
- SGLang
How to use axonlabsai/Ranger-7B 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 "axonlabsai/Ranger-7B" \ --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": "axonlabsai/Ranger-7B", "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 "axonlabsai/Ranger-7B" \ --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": "axonlabsai/Ranger-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use axonlabsai/Ranger-7B with Ollama:
ollama run hf.co/axonlabsai/Ranger-7B:Q4_K_M
- Unsloth Studio
How to use axonlabsai/Ranger-7B 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 axonlabsai/Ranger-7B 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 axonlabsai/Ranger-7B to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for axonlabsai/Ranger-7B to start chatting
- Pi
How to use axonlabsai/Ranger-7B with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf axonlabsai/Ranger-7B:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "axonlabsai/Ranger-7B:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use axonlabsai/Ranger-7B with Docker Model Runner:
docker model run hf.co/axonlabsai/Ranger-7B:Q4_K_M
- Lemonade
How to use axonlabsai/Ranger-7B with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull axonlabsai/Ranger-7B:Q4_K_M
Run and chat with the model
lemonade run user.Ranger-7B-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use axonlabsai/Ranger-7B with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf axonlabsai/Ranger-7B:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default axonlabsai/Ranger-7B:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use axonlabsai/Ranger-7B with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf axonlabsai/Ranger-7B:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "axonlabsai/Ranger-7B:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Upload chat_template.jinja with huggingface_hub
Browse files- chat_template.jinja +77 -0
chat_template.jinja
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- if not add_generation_prompt is defined %}{%- set add_generation_prompt = false %}{%- endif %}
|
| 2 |
+
{#- Two fixes over the stock DeepSeek-R1-Distill template:
|
| 3 |
+
|
| 4 |
+
1. `tools` is accepted and rendered. The stock template emits assistant
|
| 5 |
+
tool CALLS using the native <|tool_calls_begin|> tokens but has no way to
|
| 6 |
+
DECLARE the available tools, so passing tools=[...] raised
|
| 7 |
+
"can only concatenate str (not dict) to str" and every tool example was
|
| 8 |
+
silently dropped from training.
|
| 9 |
+
|
| 10 |
+
2. <think> is preserved on the FINAL assistant message. The stock template
|
| 11 |
+
ran content.split('</think>')[-1] on every assistant turn, which deletes
|
| 12 |
+
the reasoning from the training target — so no amount of think-formatted
|
| 13 |
+
data could ever teach thinking. Stale reasoning is still stripped from
|
| 14 |
+
earlier turns, which is the behaviour you actually want at inference.
|
| 15 |
+
-#}
|
| 16 |
+
{%- set ns = namespace(is_first=false, is_tool=false, is_output_first=true, system_prompt='') %}
|
| 17 |
+
{%- for message in messages %}
|
| 18 |
+
{%- if message['role'] == 'system' %}{%- set ns.system_prompt = message['content'] %}{%- endif %}
|
| 19 |
+
{%- endfor %}
|
| 20 |
+
{{- bos_token }}
|
| 21 |
+
{%- if tools %}
|
| 22 |
+
{{- ns.system_prompt }}
|
| 23 |
+
{{- '\n\n# Tools\n\nYou may call one or more of the following functions. Emit a tool call only when it is actually needed.\n\n<tools>' }}
|
| 24 |
+
{%- for tool in tools %}
|
| 25 |
+
{%- set fn = tool['function'] if tool.get('function') is defined else tool %}
|
| 26 |
+
{{- '\n' + (fn | tojson) }}
|
| 27 |
+
{%- endfor %}
|
| 28 |
+
{{- '\n</tools>' }}
|
| 29 |
+
{%- else %}
|
| 30 |
+
{{- ns.system_prompt }}
|
| 31 |
+
{%- endif %}
|
| 32 |
+
{%- set last = (messages | length) - 1 %}
|
| 33 |
+
{%- for message in messages %}
|
| 34 |
+
{%- if message['role'] == 'user' %}
|
| 35 |
+
{%- set ns.is_tool = false -%}
|
| 36 |
+
{{- '<|User|>' + message['content'] }}
|
| 37 |
+
{%- endif %}
|
| 38 |
+
{%- if message['role'] == 'assistant' and message.get('tool_calls') %}
|
| 39 |
+
{%- set ns.is_tool = false -%}
|
| 40 |
+
{%- for tool in message['tool_calls'] %}
|
| 41 |
+
{%- set fn = tool['function'] %}
|
| 42 |
+
{%- set args = fn['arguments'] if fn['arguments'] is string else (fn['arguments'] | tojson) %}
|
| 43 |
+
{%- if not ns.is_first %}
|
| 44 |
+
{{- '<|Assistant|><|tool▁calls▁begin|><|tool▁call▁begin|>' + (tool.get('type') or 'function') + '<|tool▁sep|>' + fn['name'] + '\n```json\n' + args + '\n```<|tool▁call▁end|>' }}
|
| 45 |
+
{%- set ns.is_first = true -%}
|
| 46 |
+
{%- else %}
|
| 47 |
+
{{- '\n<|tool▁call▁begin|>' + (tool.get('type') or 'function') + '<|tool▁sep|>' + fn['name'] + '\n```json\n' + args + '\n```<|tool▁call▁end|>' }}
|
| 48 |
+
{%- endif %}
|
| 49 |
+
{%- endfor %}
|
| 50 |
+
{{- '<|tool▁calls▁end|><|end▁of▁sentence|>' }}
|
| 51 |
+
{%- set ns.is_first = false -%}
|
| 52 |
+
{%- endif %}
|
| 53 |
+
{%- if message['role'] == 'assistant' and message.get('content') %}
|
| 54 |
+
{%- set content = message['content'] %}
|
| 55 |
+
{#- keep reasoning on the last turn (the training target); drop it from history -#}
|
| 56 |
+
{%- if '</think>' in content and not loop.index0 == last %}
|
| 57 |
+
{%- set content = content.split('</think>')[-1] %}
|
| 58 |
+
{%- endif %}
|
| 59 |
+
{%- if ns.is_tool %}
|
| 60 |
+
{{- '<|tool▁outputs▁end|>' + content + '<|end▁of▁sentence|>' }}
|
| 61 |
+
{%- set ns.is_tool = false -%}
|
| 62 |
+
{%- else %}
|
| 63 |
+
{{- '<|Assistant|>' + content + '<|end▁of▁sentence|>' }}
|
| 64 |
+
{%- endif %}
|
| 65 |
+
{%- endif %}
|
| 66 |
+
{%- if message['role'] == 'tool' %}
|
| 67 |
+
{%- set ns.is_tool = true -%}
|
| 68 |
+
{%- if ns.is_output_first %}
|
| 69 |
+
{{- '<|tool▁outputs▁begin|><|tool▁output▁begin|>' + message['content'] + '<|tool▁output▁end|>' }}
|
| 70 |
+
{%- set ns.is_output_first = false %}
|
| 71 |
+
{%- else %}
|
| 72 |
+
{{- '\n<|tool▁output▁begin|>' + message['content'] + '<|tool▁output▁end|>' }}
|
| 73 |
+
{%- endif %}
|
| 74 |
+
{%- endif %}
|
| 75 |
+
{%- endfor -%}
|
| 76 |
+
{%- if ns.is_tool %}{{- '<|tool▁outputs▁end|>' }}{%- endif %}
|
| 77 |
+
{%- if add_generation_prompt and not ns.is_tool %}{{- '<|Assistant|>' }}{%- endif %}
|