Text Generation
Transformers
Safetensors
GGUF
English
code
coding
software-engineering
autonomous-agent
ollama
conversational
Instructions to use NIM-AI/NIM-2-Coder-7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use NIM-AI/NIM-2-Coder-7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="NIM-AI/NIM-2-Coder-7B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("NIM-AI/NIM-2-Coder-7B", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use NIM-AI/NIM-2-Coder-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 NIM-AI/NIM-2-Coder-7B:Q4_K_M # Run inference directly in the terminal: llama cli -hf NIM-AI/NIM-2-Coder-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 NIM-AI/NIM-2-Coder-7B:Q4_K_M # Run inference directly in the terminal: llama cli -hf NIM-AI/NIM-2-Coder-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 NIM-AI/NIM-2-Coder-7B:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf NIM-AI/NIM-2-Coder-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 NIM-AI/NIM-2-Coder-7B:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf NIM-AI/NIM-2-Coder-7B:Q4_K_M
Use Docker
docker model run hf.co/NIM-AI/NIM-2-Coder-7B:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use NIM-AI/NIM-2-Coder-7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "NIM-AI/NIM-2-Coder-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": "NIM-AI/NIM-2-Coder-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/NIM-AI/NIM-2-Coder-7B:Q4_K_M
- SGLang
How to use NIM-AI/NIM-2-Coder-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 "NIM-AI/NIM-2-Coder-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": "NIM-AI/NIM-2-Coder-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 "NIM-AI/NIM-2-Coder-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": "NIM-AI/NIM-2-Coder-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use NIM-AI/NIM-2-Coder-7B with Ollama:
ollama run hf.co/NIM-AI/NIM-2-Coder-7B:Q4_K_M
- Unsloth Desktop
- Docker Model Runner
How to use NIM-AI/NIM-2-Coder-7B with Docker Model Runner:
docker model run hf.co/NIM-AI/NIM-2-Coder-7B:Q4_K_M
- Lemonade
How to use NIM-AI/NIM-2-Coder-7B with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull NIM-AI/NIM-2-Coder-7B:Q4_K_M
Run and chat with the model
lemonade run user.NIM-2-Coder-7B-Q4_K_M
List all available models
lemonade list
- Atomic Chat
Download lora/tokenizer_config.json from NIM-AI/NIM-2-Coder-7B: direct link, hf CLI and curl.
- Browser
- Download file 4.44 kB
-
https://huggingface.co/NIM-AI/NIM-2-Coder-7B/resolve/main/lora/tokenizer_config.json
- Command line
-
hf download hf://NIM-AI/NIM-2-Coder-7B/lora/tokenizer_config.json
-
curl -L -o tokenizer_config.json https://huggingface.co/NIM-AI/NIM-2-Coder-7B/resolve/main/lora/tokenizer_config.json
4.44 kB
| { | |
| "add_prefix_space": null, | |
| "backend": "tokenizers", | |
| "bos_token": null, | |
| "eos_token": "<|im_end|>", | |
| "model_max_length": 1000000000000000019884624838656, | |
| "pad_token": "<|PAD_TOKEN|>", | |
| "tokenizer_class": "Qwen2Tokenizer", | |
| "unk_token": null, | |
| "added_tokens_decoder": { | |
| "151643": { | |
| "content": "<|endoftext|>", | |
| "single_word": false, | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "special": true | |
| }, | |
| "151644": { | |
| "content": "<|im_start|>", | |
| "single_word": false, | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "special": true | |
| }, | |
| "151645": { | |
| "content": "<|im_end|>", | |
| "single_word": false, | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "special": true | |
| }, | |
| "151646": { | |
| "content": "<|object_ref_start|>", | |
| "single_word": false, | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "special": true | |
| }, | |
| "151647": { | |
| "content": "<|object_ref_end|>", | |
| "single_word": false, | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "special": true | |
| }, | |
| "151648": { | |
| "content": "<|box_start|>", | |
| "single_word": false, | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "special": true | |
| }, | |
| "151649": { | |
| "content": "<|box_end|>", | |
| "single_word": false, | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "special": true | |
| }, | |
| "151650": { | |
| "content": "<|quad_start|>", | |
| "single_word": false, | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "special": true | |
| }, | |
| "151651": { | |
| "content": "<|quad_end|>", | |
| "single_word": false, | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "special": true | |
| }, | |
| "151652": { | |
| "content": "<|vision_start|>", | |
| "single_word": false, | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "special": true | |
| }, | |
| "151653": { | |
| "content": "<|vision_end|>", | |
| "single_word": false, | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "special": true | |
| }, | |
| "151654": { | |
| "content": "<|vision_pad|>", | |
| "single_word": false, | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "special": true | |
| }, | |
| "151655": { | |
| "content": "<|image_pad|>", | |
| "single_word": false, | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "special": true | |
| }, | |
| "151656": { | |
| "content": "<|video_pad|>", | |
| "single_word": false, | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "special": true | |
| }, | |
| "151657": { | |
| "content": "<tool_call>", | |
| "single_word": false, | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "special": false | |
| }, | |
| "151658": { | |
| "content": "</tool_call>", | |
| "single_word": false, | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "special": false | |
| }, | |
| "151659": { | |
| "content": "<|fim_prefix|>", | |
| "single_word": false, | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "special": false | |
| }, | |
| "151660": { | |
| "content": "<|fim_middle|>", | |
| "single_word": false, | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "special": false | |
| }, | |
| "151661": { | |
| "content": "<|fim_suffix|>", | |
| "single_word": false, | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "special": false | |
| }, | |
| "151662": { | |
| "content": "<|fim_pad|>", | |
| "single_word": false, | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "special": false | |
| }, | |
| "151663": { | |
| "content": "<|repo_name|>", | |
| "single_word": false, | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "special": false | |
| }, | |
| "151664": { | |
| "content": "<|file_sep|>", | |
| "single_word": false, | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "special": false | |
| }, | |
| "151665": { | |
| "content": "<|PAD_TOKEN|>", | |
| "single_word": false, | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "special": true | |
| } | |
| } | |
| } | |