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
| """Git Operations Tool - git commands.""" | |
| from __future__ import annotations | |
| import subprocess | |
| from typing import Dict, Any | |
| from .base import Tool, ToolResult, ToolContext, ToolCategory, ToolSafety | |
| SAFE_GIT_COMMANDS = { | |
| "status", "log", "diff", "show", "branch", "tag", | |
| "ls-files", "ls-tree", "blame", "shortlog", "describe", | |
| "rev-parse", "config --get", "remote -v", "stash list", | |
| } | |
| MODERATE_GIT_COMMANDS = { | |
| "add", "commit", "fetch", "pull", "merge", "rebase", | |
| "stash", "checkout -b", "switch -c", "tag -a", | |
| } | |
| DANGEROUS_GIT_COMMANDS = { | |
| "push", "reset --hard", "clean -fd", "push --force", | |
| "branch -D", "tag -d", "rebase -i", | |
| } | |
| class GitTool(Tool): | |
| """Execute git commands với safety checks.""" | |
| category = ToolCategory.FILE | |
| safety = ToolSafety.DANGEROUS # default for safety | |
| def name(self) -> str: | |
| return "git_ops" | |
| def description(self) -> str: | |
| return ( | |
| "Execute git commands. Auto-classify safety: " | |
| "read-only (status, log, diff) = SAFE, " | |
| "writes (commit, merge) = MODERATE, " | |
| "destructive (push, reset --hard) = DANGEROUS." | |
| ) | |
| def parameters(self) -> Dict[str, Any]: | |
| return { | |
| "type": "object", | |
| "properties": { | |
| "command": {"type": "string", "description": "Git command (e.g. 'status', 'add .', 'commit -m \"msg\"')"}, | |
| "repo": {"type": "string", "description": "Path to git repo (default: cwd)"}, | |
| }, | |
| "required": ["command"], | |
| } | |
| def validate_args(self, args: Dict[str, Any]) -> Any: | |
| cmd = args.get("command", "").strip() | |
| if not cmd: | |
| return "Empty git command" | |
| # Check for dangerous patterns | |
| for danger in DANGEROUS_GIT_COMMANDS: | |
| if danger in cmd: | |
| args["_safety_override"] = "dangerous" | |
| break | |
| return None | |
| def execute(self, args: Dict[str, Any], context: ToolContext) -> ToolResult: | |
| cmd = args["command"] | |
| repo = args.get("repo") or context.working_dir | |
| full_cmd = f"git -C {repo} {cmd}" | |
| try: | |
| result = subprocess.run( | |
| full_cmd, | |
| shell=True, | |
| 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={"git_command": cmd, "repo": repo}, | |
| ) | |
| except subprocess.TimeoutExpired: | |
| return ToolResult( | |
| success=False, | |
| error=f"Git command timed out", | |
| return_code=124, | |
| ) | |
| except Exception as e: | |
| return ToolResult(success=False, error=str(e), return_code=1) | |