Instructions to use Trelis/Llama-2-7b-chat-hf-function-calling-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Trelis/Llama-2-7b-chat-hf-function-calling-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Trelis/Llama-2-7b-chat-hf-function-calling-v2")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Trelis/Llama-2-7b-chat-hf-function-calling-v2") model = AutoModelForCausalLM.from_pretrained("Trelis/Llama-2-7b-chat-hf-function-calling-v2") - llama-cpp-python
How to use Trelis/Llama-2-7b-chat-hf-function-calling-v2 with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="Trelis/Llama-2-7b-chat-hf-function-calling-v2", filename="ggml-vocab-llama.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use Trelis/Llama-2-7b-chat-hf-function-calling-v2 with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf Trelis/Llama-2-7b-chat-hf-function-calling-v2:Q3_K_M # Run inference directly in the terminal: llama-cli -hf Trelis/Llama-2-7b-chat-hf-function-calling-v2:Q3_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf Trelis/Llama-2-7b-chat-hf-function-calling-v2:Q3_K_M # Run inference directly in the terminal: llama-cli -hf Trelis/Llama-2-7b-chat-hf-function-calling-v2:Q3_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 Trelis/Llama-2-7b-chat-hf-function-calling-v2:Q3_K_M # Run inference directly in the terminal: ./llama-cli -hf Trelis/Llama-2-7b-chat-hf-function-calling-v2:Q3_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 Trelis/Llama-2-7b-chat-hf-function-calling-v2:Q3_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf Trelis/Llama-2-7b-chat-hf-function-calling-v2:Q3_K_M
Use Docker
docker model run hf.co/Trelis/Llama-2-7b-chat-hf-function-calling-v2:Q3_K_M
- LM Studio
- Jan
- vLLM
How to use Trelis/Llama-2-7b-chat-hf-function-calling-v2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Trelis/Llama-2-7b-chat-hf-function-calling-v2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Trelis/Llama-2-7b-chat-hf-function-calling-v2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Trelis/Llama-2-7b-chat-hf-function-calling-v2:Q3_K_M
- SGLang
How to use Trelis/Llama-2-7b-chat-hf-function-calling-v2 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 "Trelis/Llama-2-7b-chat-hf-function-calling-v2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Trelis/Llama-2-7b-chat-hf-function-calling-v2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "Trelis/Llama-2-7b-chat-hf-function-calling-v2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Trelis/Llama-2-7b-chat-hf-function-calling-v2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Ollama
How to use Trelis/Llama-2-7b-chat-hf-function-calling-v2 with Ollama:
ollama run hf.co/Trelis/Llama-2-7b-chat-hf-function-calling-v2:Q3_K_M
- Unsloth Studio new
How to use Trelis/Llama-2-7b-chat-hf-function-calling-v2 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 Trelis/Llama-2-7b-chat-hf-function-calling-v2 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 Trelis/Llama-2-7b-chat-hf-function-calling-v2 to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Trelis/Llama-2-7b-chat-hf-function-calling-v2 to start chatting
- Docker Model Runner
How to use Trelis/Llama-2-7b-chat-hf-function-calling-v2 with Docker Model Runner:
docker model run hf.co/Trelis/Llama-2-7b-chat-hf-function-calling-v2:Q3_K_M
- Lemonade
How to use Trelis/Llama-2-7b-chat-hf-function-calling-v2 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Trelis/Llama-2-7b-chat-hf-function-calling-v2:Q3_K_M
Run and chat with the model
lemonade run user.Llama-2-7b-chat-hf-function-calling-v2-Q3_K_M
List all available models
lemonade list
How to send response back to Model
The llama2 model is giving me the function that needs to be executed together with the appropriate arguments based on the user prompt. In order for the model to remember the chat's context, I want to pass the function's response back to it. How these things can be accomplished.
Have you noticed any significant latency when handling function calls with this model version? I've encountered some inconsistencies in response times compared to vanilla Llama-2, especially when invoking external tools. Any insights or tweaks that could stabilize performance would be appreciated.
What’s the tool-call success rate when using 4-bit quantization in a 7B model with a 128-token context? I’ve seen inconsistencies in tool return parsing when prompt templates include dynamic variables—does the model retain state across tool invocations or reset after each function call? Also, any observed latency spikes during function execution in the last 10 tokens? Real-world stability matters more than idealized benchmarks.
Tool-call stability drops below 80% at >1000 tokens in prompt—does this happen due to prompt length or function call overhead? Also, does the v2 function-calling layer introduce token leakage when tools are invoked mid-prompt? Observed 3–5% increase in token cost per function call in 7B baseline. Any quantization artifacts when using Q4_K_M in 4-bit? Specific to tool selection or execution timing?
Tool-call stability drops after 3+ consecutive function invocations in 7B models—observed with prompt templates that include dynamic variable injection. Inference time spikes by ~180ms per call when using JSON-formatted tool outputs in non-structured prompts. Quantization to Q4_K_M causes tool response truncation in 12% of cases with long output chains. Local runs show tool-call failure rates increase when model context window exceeds 32k tokens. These behaviors are inconsistent across prompt templates—specifically, structured JSON headers reduce failure rates by 40%.