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
Download nexus/tools/archive.py from AdminReal/NexusCoder: direct link, hf CLI and curl.
- Browser
- Download file 5.19 kB
-
https://huggingface.co/AdminReal/NexusCoder/resolve/main/nexus/tools/archive.py
- Command line
-
hf download hf://AdminReal/NexusCoder/nexus/tools/archive.py
-
curl -L -o archive.py https://huggingface.co/AdminReal/NexusCoder/resolve/main/nexus/tools/archive.py
5.19 kB
| """Archive Tool - zip/tar operations.""" | |
| from __future__ import annotations | |
| import os | |
| import zipfile | |
| import tarfile | |
| from typing import Dict, Any | |
| from .base import Tool, ToolResult, ToolContext, ToolCategory, ToolSafety | |
| class ArchiveTool(Tool): | |
| """Tạo/giải nén zip/tar archives.""" | |
| category = ToolCategory.FILE | |
| safety = ToolSafety.MODERATE | |
| def name(self) -> str: | |
| return "archive" | |
| def description(self) -> str: | |
| return "Tạo/giải nén ZIP/TAR/GZ archives." | |
| def parameters(self) -> Dict[str, Any]: | |
| return { | |
| "type": "object", | |
| "properties": { | |
| "action": {"type": "string", "enum": ["create", "extract", "list"]}, | |
| "archive_path": {"type": "string"}, | |
| "source_path": {"type": "string", "description": "For create: dir to compress; for extract: target dir"}, | |
| "format": {"type": "string", "enum": ["zip", "tar", "tar.gz", "tar.bz2"], "default": "zip"}, | |
| }, | |
| "required": ["action", "archive_path"], | |
| } | |
| def execute(self, args: Dict[str, Any], context: ToolContext) -> ToolResult: | |
| action = args["action"] | |
| archive_path = args["archive_path"] | |
| source = args.get("source_path") | |
| fmt = args.get("format", "zip") | |
| full_archive = archive_path if os.path.isabs(archive_path) else os.path.join(context.working_dir, archive_path) | |
| try: | |
| if action == "create": | |
| if not source: | |
| return ToolResult(success=False, error="source_path required for create", return_code=2) | |
| full_source = source if os.path.isabs(source) else os.path.join(context.working_dir, source) | |
| if not os.path.exists(full_source): | |
| return ToolResult(success=False, error=f"Source not found: {full_source}", return_code=1) | |
| if fmt == "zip": | |
| with zipfile.ZipFile(full_archive, "w", zipfile.ZIP_DEFLATED) as zf: | |
| if os.path.isfile(full_source): | |
| zf.write(full_source, os.path.basename(full_source)) | |
| else: | |
| for root, dirs, files in os.walk(full_source): | |
| for fname in files: | |
| fpath = os.path.join(root, fname) | |
| arcname = os.path.relpath(fpath, full_source) | |
| zf.write(fpath, arcname) | |
| else: | |
| mode = {"tar": "w", "tar.gz": "w:gz", "tar.bz2": "w:bz2"}[fmt] | |
| with tarfile.open(full_archive, mode) as tf: | |
| tf.add(full_source, arcname=os.path.basename(full_source)) | |
| size = os.path.getsize(full_archive) | |
| return ToolResult( | |
| success=True, | |
| output=f"Created {full_archive} ({size} bytes)", | |
| artifacts=[full_archive], | |
| metadata={"action": "create", "format": fmt, "size": size}, | |
| ) | |
| elif action == "extract": | |
| if not source: | |
| source = os.path.dirname(full_archive) or "." | |
| full_target = source if os.path.isabs(source) else os.path.join(context.working_dir, source) | |
| os.makedirs(full_target, exist_ok=True) | |
| if full_archive.endswith(".zip"): | |
| with zipfile.ZipFile(full_archive, "r") as zf: | |
| zf.extractall(full_target) | |
| names = zf.namelist() | |
| else: | |
| with tarfile.open(full_archive, "r:*") as tf: | |
| tf.extractall(full_target) | |
| names = tf.getnames() | |
| return ToolResult( | |
| success=True, | |
| output=f"Extracted {len(names)} files to {full_target}", | |
| metadata={"action": "extract", "files": names[:20], "total": len(names)}, | |
| ) | |
| elif action == "list": | |
| if full_archive.endswith(".zip"): | |
| with zipfile.ZipFile(full_archive, "r") as zf: | |
| names = zf.namelist() | |
| else: | |
| with tarfile.open(full_archive, "r:*") as tf: | |
| names = tf.getnames() | |
| output = "\n".join(names[:100]) | |
| if len(names) > 100: | |
| output += f"\n... and {len(names) - 100} more" | |
| return ToolResult( | |
| success=True, | |
| output=output or "(empty archive)", | |
| metadata={"total_files": len(names)}, | |
| ) | |
| else: | |
| return ToolResult(success=False, error=f"Unknown action: {action}", return_code=2) | |
| except Exception as e: | |
| return ToolResult(success=False, error=str(e), return_code=1) | |