Text Generation
Transformers
Safetensors
GGUF
PyTorch
English
llama
facebook
meta
llama-2
functions
function calling
sharded
text-generation-inference
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 Settings
- 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
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
Commit ·
b3591eb
1
Parent(s): 055776a
add tips on best models
Browse files
README.md
CHANGED
|
@@ -43,14 +43,20 @@ Latest Models:
|
|
| 43 |
Other Models:
|
| 44 |
- Llama-13B-chat with function calling ([Base Model](https://huggingface.co/Trelis/Llama-2-13b-chat-hf-function-calling-v2)), ([PEFT Adapters](https://huggingface.co/Trelis/Llama-2-13b-chat-hf-function-calling-adapters-v2)) - Paid, [purchase here](https://buy.stripe.com/9AQ7te3lHdmbdZ68wz)
|
| 45 |
|
| 46 |
-
##
|
| 47 |
-
|
| 48 |
1. Larger models are better at handling function calling. The cross entropy training losses are approximately 0.5 for 7B, 0.4 for 13B, 0.3 for 70B. The absolute numbers don't mean anything but the relative values offer a sense of relative performance.
|
| 49 |
1. Provide very clear function descriptions, including whether the arguments are required or what the default values should be.
|
| 50 |
1. Make sure to post-process the language model's response to check that all necessary information is provided by the user. If not, prompt the user to let them know they need to provide more info (e.g. their name, order number etc.)
|
| 51 |
|
| 52 |
Check out this video overview of performance [here](https://www.loom.com/share/8d7467de95e04af29ff428c46286946c?sid=683c970e-6063-4f1e-b184-894cc1d96115)
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
## Licensing
|
| 55 |
|
| 56 |
Llama-7B with function calling is licensed according to the Meta Community license.
|
|
|
|
| 43 |
Other Models:
|
| 44 |
- Llama-13B-chat with function calling ([Base Model](https://huggingface.co/Trelis/Llama-2-13b-chat-hf-function-calling-v2)), ([PEFT Adapters](https://huggingface.co/Trelis/Llama-2-13b-chat-hf-function-calling-adapters-v2)) - Paid, [purchase here](https://buy.stripe.com/9AQ7te3lHdmbdZ68wz)
|
| 45 |
|
| 46 |
+
## Which model is best for what?
|
|
|
|
| 47 |
1. Larger models are better at handling function calling. The cross entropy training losses are approximately 0.5 for 7B, 0.4 for 13B, 0.3 for 70B. The absolute numbers don't mean anything but the relative values offer a sense of relative performance.
|
| 48 |
1. Provide very clear function descriptions, including whether the arguments are required or what the default values should be.
|
| 49 |
1. Make sure to post-process the language model's response to check that all necessary information is provided by the user. If not, prompt the user to let them know they need to provide more info (e.g. their name, order number etc.)
|
| 50 |
|
| 51 |
Check out this video overview of performance [here](https://www.loom.com/share/8d7467de95e04af29ff428c46286946c?sid=683c970e-6063-4f1e-b184-894cc1d96115)
|
| 52 |
|
| 53 |
+
Some short tips based on models as of November 2023:
|
| 54 |
+
- DeepSeek Coder (all sizes) = best coding model.
|
| 55 |
+
- Yi 34B = best for long context.
|
| 56 |
+
- Llama 70B = strongest overall model (4k context).
|
| 57 |
+
- Mistral 7B = Best model if you have only 8 GB of VRAM (run with quantization).
|
| 58 |
+
Zephyr is better than Mistral 7B but is not openly licensed for commercial use.
|
| 59 |
+
|
| 60 |
## Licensing
|
| 61 |
|
| 62 |
Llama-7B with function calling is licensed according to the Meta Community license.
|