Text Generation
Transformers
Safetensors
English
gemma
function calling
on-device language model
android
conversational
text-generation-inference
Instructions to use NexaAI/Octopus-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use NexaAI/Octopus-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="NexaAI/Octopus-v2") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("NexaAI/Octopus-v2") model = AutoModelForCausalLM.from_pretrained("NexaAI/Octopus-v2", 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use NexaAI/Octopus-v2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "NexaAI/Octopus-v2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "NexaAI/Octopus-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/NexaAI/Octopus-v2
- SGLang
How to use NexaAI/Octopus-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 "NexaAI/Octopus-v2" \ --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": "NexaAI/Octopus-v2", "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 "NexaAI/Octopus-v2" \ --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": "NexaAI/Octopus-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use NexaAI/Octopus-v2 with Docker Model Runner:
docker model run hf.co/NexaAI/Octopus-v2
Commit History
-
Update benchmark with GPT-4O
Verified signaturee997f4c -
update benchmark for GPT-4O
Verified signature15b7686
-
Update added_tokens.json
Verified signature63b697e
-
Update README.md
Verified signature524fc80 -
Update README.md
Verified signaturef8d8ba9
-
add benchmark with openELM and Phi-3
Zack Zhiyuan Li10bd713 -
Add Microsoft Phi-3 benchmark
Verified signature3e77051
-
Update README.md
Verified signature8d122c4
-
Update android function readme
Verified signatured2d36e6 -
add car function definitions
Verified signature7d7e8ff
-
Add v3 logo
Verified signatureacbc882 -
Upload octopus-v3.jpeg
Verified signatureb0c20dc -
Update README.md
Verified signature77bd3f5 -
Update README.md
Verified signature0f44101
-
update
Verified signatureeb242cb
-
update
Verified signature468ae1a -
Update README.md
Verified signature0e82a0e -
Update README.md
Verified signature5bfa5fe -
Update README.md
Verified signatureb8b5434 -
Update README.md
Verified signature103d19a -
update
Verified signature0bef7a2
-
polish
Verified signaturea26d9d4 -
update
Verified signature942a5e6 -
Update README.md
Verified signaturea291655 -
Update README.md
Verified signaturec2ec018 -
Upload android_benchmark.xlsx
Verified signature74bc7c1 -
Fix model ID (#1)
Verified signature- Fix model ID (2c8b980cbc0a10871e898fee5ff4a191a6bcdc2f) Co-authored-by: Omar Sanseviero <osanseviero@users.noreply.huggingface.co>d65d651 -
GemmaForCausalLM import error fix (#3)
Verified signature- GemmaForCausalLM import error fix (3eda1f6e8363425f4045262d9957ff7ff401e9a5) Co-authored-by: Joseph Pollack <Tonic@users.noreply.huggingface.co>9572755
-
Update README.md
Verified signature1f09c6d
-
update README
Zack Zhiyuan Li7f2687d -
reformat
Zack Zhiyuan Li7c67e23 -
add logo
Zack Zhiyuan Licf57a97 -
add video demo
Zack Zhiyuan Li9be03ce -
update plots
Zack Zhiyuan Li537313f -
add data example
Zack Zhiyuan Li2727916 -
Update README.md
Verified signature140dfaa -
Update README.md
Verified signature71511b8
-
Update config.json
Verified signaturef01fb13 -
Update README.md
Verified signature87d4211 -
Update README.md
Verified signaturef4c0675
-
Fix some typo
Verified signature540d2db -
wip
Zack Zhiyuan Li9cfb06f -
wip
Zack Zhiyuan Li4c0721c
-
Upload GemmaForCausalLM
Verified signature36a65f5 -
Upload tokenizer
Verified signature3eaf24a -
initial commit
Verified signature906b4ff