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
| """Network Tools - DNS, ping, port check.""" | |
| from __future__ import annotations | |
| import socket | |
| import subprocess | |
| from typing import Dict, Any | |
| from .base import Tool, ToolResult, ToolContext, ToolCategory, ToolSafety | |
| class DNSTool(Tool): | |
| """DNS lookup: A, AAAA, MX, NS, CNAME, TXT records.""" | |
| category = ToolCategory.NETWORK | |
| safety = ToolSafety.SAFE | |
| def name(self) -> str: | |
| return "dns_lookup" | |
| def description(self) -> str: | |
| return "DNS lookup: resolve domain → IP (A/AAAA), MX, NS, CNAME, TXT records." | |
| def parameters(self) -> Dict[str, Any]: | |
| return { | |
| "type": "object", | |
| "properties": { | |
| "domain": {"type": "string"}, | |
| "record_type": { | |
| "type": "string", | |
| "enum": ["A", "AAAA", "MX", "NS", "CNAME", "TXT", "SOA", "ANY"], | |
| "default": "A", | |
| }, | |
| }, | |
| "required": ["domain"], | |
| } | |
| def execute(self, args: Dict[str, Any], context: ToolContext) -> ToolResult: | |
| domain = args["domain"] | |
| record_type = args.get("record_type", "A") | |
| try: | |
| if record_type == "A": | |
| results = socket.getaddrinfo(domain, None, socket.AF_INET) | |
| ips = list(set(r[4][0] for r in results)) | |
| return ToolResult( | |
| success=True, | |
| output=f"A records for {domain}:\n" + "\n".join(f" {ip}" for ip in ips), | |
| metadata={"domain": domain, "records": ips}, | |
| ) | |
| elif record_type == "AAAA": | |
| results = socket.getaddrinfo(domain, None, socket.AF_INET6) | |
| ips = list(set(r[4][0] for r in results)) | |
| return ToolResult( | |
| success=True, | |
| output=f"AAAA records for {domain}:\n" + "\n".join(f" {ip}" for ip in ips), | |
| metadata={"domain": domain, "records": ips}, | |
| ) | |
| else: | |
| # Use dig if available | |
| try: | |
| result = subprocess.run( | |
| ["dig", "+short", domain, record_type], | |
| capture_output=True, | |
| text=True, | |
| timeout=10, | |
| check=False, | |
| ) | |
| if result.returncode == 0: | |
| records = [r.strip() for r in result.stdout.splitlines() if r.strip()] | |
| return ToolResult( | |
| success=True, | |
| output=f"{record_type} records for {domain}:\n" + "\n".join(f" {r}" for r in records), | |
| metadata={"domain": domain, "records": records}, | |
| ) | |
| else: | |
| return ToolResult( | |
| success=False, | |
| error=f"dig failed: {result.stderr}", | |
| return_code=1, | |
| ) | |
| except FileNotFoundError: | |
| return ToolResult( | |
| success=False, | |
| error="dig not installed. Only A/AAAA supported via socket.", | |
| return_code=1, | |
| ) | |
| except socket.gaierror as e: | |
| return ToolResult(success=False, error=f"DNS resolution failed: {e}", return_code=1) | |
| except Exception as e: | |
| return ToolResult(success=False, error=str(e), return_code=1) | |
| class PingTool(Tool): | |
| """Ping host để check connectivity.""" | |
| category = ToolCategory.NETWORK | |
| safety = ToolSafety.SAFE | |
| def name(self) -> str: | |
| return "ping" | |
| def description(self) -> str: | |
| return "Ping host để kiểm tra connectivity và đo latency." | |
| def parameters(self) -> Dict[str, Any]: | |
| return { | |
| "type": "object", | |
| "properties": { | |
| "host": {"type": "string"}, | |
| "count": {"type": "integer", "default": 4}, | |
| "timeout": {"type": "integer", "default": 5}, | |
| }, | |
| "required": ["host"], | |
| } | |
| def execute(self, args: Dict[str, Any], context: ToolContext) -> ToolResult: | |
| host = args["host"] | |
| count = args.get("count", 4) | |
| # Detect OS for ping flag | |
| import sys | |
| flag = "-n" if sys.platform == "win32" else "-c" | |
| wait_flag = "-w" if sys.platform == "win32" else "-W" | |
| try: | |
| result = subprocess.run( | |
| ["ping", flag, str(count), wait_flag, str(args.get("timeout", 5)), host], | |
| capture_output=True, | |
| text=True, | |
| timeout=context.timeout, | |
| check=False, | |
| ) | |
| return ToolResult( | |
| success=(result.returncode == 0), | |
| output=result.stdout, | |
| error=result.stderr if result.stderr else None, | |
| return_code=result.returncode, | |
| metadata={"host": host, "count": count}, | |
| ) | |
| except FileNotFoundError: | |
| return ToolResult(success=False, error="ping command not found", return_code=1) | |
| except subprocess.TimeoutExpired: | |
| return ToolResult(success=False, error="Ping timed out", return_code=124) | |
| except Exception as e: | |
| return ToolResult(success=False, error=str(e), return_code=1) | |