Text Generation
Transformers
Safetensors
qwen2
coder
code
agent
conversational
text-generation-inference
Instructions to use AdminReal/NexusCoder with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AdminReal/NexusCoder with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="AdminReal/NexusCoder") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("AdminReal/NexusCoder") model = AutoModelForCausalLM.from_pretrained("AdminReal/NexusCoder", 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use AdminReal/NexusCoder with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AdminReal/NexusCoder" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AdminReal/NexusCoder", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/AdminReal/NexusCoder
- SGLang
How to use AdminReal/NexusCoder 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 "AdminReal/NexusCoder" \ --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": "AdminReal/NexusCoder", "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 "AdminReal/NexusCoder" \ --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": "AdminReal/NexusCoder", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use AdminReal/NexusCoder with Docker Model Runner:
docker model run hf.co/AdminReal/NexusCoder
| """ | |
| Script đếm tham số Nexus Coder 10B / 1.5B active | |
| ================================================= | |
| Chạy: python scripts/count_params.py | |
| """ | |
| import sys | |
| import os | |
| sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | |
| from nexus.config import NexusConfig, print_config_summary | |
| def main(): | |
| """In tóm tắt cấu hình và tham số.""" | |
| config = NexusConfig() | |
| print_config_summary(config) | |
| stats = config.estimated_total_params() | |
| print("\n📋 Chi tiết tính toán tham số:") | |
| print(f" Embedding (vocab×hidden): {stats['embedding']:,} ({stats['embedding']/1e6:.1f}M)") | |
| print(f" Attention per layer: {stats['attention_per_layer']:,} ({stats['attention_per_layer']/1e6:.1f}M)") | |
| print(f" MoE per layer (total): {stats['moe_total_per_layer']:,} ({stats['moe_total_per_layer']/1e6:.1f}M)") | |
| print(f" MoE per layer (active): {stats['moe_active_per_layer']:,} ({stats['moe_active_per_layer']/1e6:.1f}M)") | |
| print(f" Router per layer: {stats['router_per_layer']:,}") | |
| print(f" Per layer (total): {stats['per_layer_total']:,} ({stats['per_layer_total']/1e6:.1f}M)") | |
| print(f" Per layer (active): {stats['per_layer_active']:,} ({stats['per_layer_active']/1e6:.1f}M)") | |
| print(f" Số layers: {stats['total_layers']}") | |
| print() | |
| print(f" ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━") | |
| print(f" Tổng tham số: {stats['total_params']:>15,} ({stats['total_params_billion']:.2f}B)") | |
| print(f" Tham số active:{stats['active_params']:>15,} ({stats['active_params_billion']:.2f}B)") | |
| print(f" ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━") | |
| # Verify | |
| assert 9.5e9 < stats["total_params"] < 11e9, "❌ Total params không đúng (phải ~10B)" | |
| assert 1.3e9 < stats["active_params"] < 1.7e9, "❌ Active params không đúng (phải ~1.5B)" | |
| print("\n✅ Đã xác nhận: 10B tổng tham số / 1.5B tham số active - đúng theo yêu cầu!") | |
| if __name__ == "__main__": | |
| main() | |