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)# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("NexaAI/Octopus-v2") model = AutoModelForMultimodalLM.from_pretrained("NexaAI/Octopus-v2") 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]:])) - 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 for GPT-4O 15b7686 verified
Update added_tokens.json 63b697e verified
Update README.md 524fc80 verified
Update README.md f8d8ba9 verified
add benchmark with openELM and Phi-3 10bd713
Zack Zhiyuan Li commited on
Add Microsoft Phi-3 benchmark 3e77051 verified
Update README.md 8d122c4 verified
Update android function readme d2d36e6 verified
add car function definitions 7d7e8ff verified
Add v3 logo acbc882 verified
Upload octopus-v3.jpeg b0c20dc verified
Update README.md 77bd3f5 verified
Update README.md 0f44101 verified
update eb242cb verified
update 468ae1a verified
Update README.md 0e82a0e verified
Update README.md 5bfa5fe verified
Update README.md b8b5434 verified
Update README.md 103d19a verified
update 0bef7a2 verified
polish a26d9d4 verified
update 942a5e6 verified
Update README.md a291655 verified
Update README.md c2ec018 verified
Upload android_benchmark.xlsx 74bc7c1 verified
Fix model ID (#1) d65d651 verified
GemmaForCausalLM import error fix (#3) 9572755 verified
Update README.md 1f09c6d verified
update README 7f2687d
Zack Zhiyuan Li commited on
reformat 7c67e23
Zack Zhiyuan Li commited on
add logo cf57a97
Zack Zhiyuan Li commited on
add video demo 9be03ce
Zack Zhiyuan Li commited on
update plots 537313f
Zack Zhiyuan Li commited on
add data example 2727916
Zack Zhiyuan Li commited on
Update README.md 140dfaa verified
Update README.md 71511b8 verified
Update config.json f01fb13 verified
Update README.md 87d4211 verified
Update README.md f4c0675 verified
Fix some typo 540d2db verified
wip 9cfb06f
Zack Zhiyuan Li commited on
wip 4c0721c
Zack Zhiyuan Li commited on