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/skills/code_minification.py from AdminReal/NexusCoder: direct link, hf CLI and curl.
- Browser
- Download file 5.66 kB
-
https://huggingface.co/AdminReal/NexusCoder/resolve/main/nexus/skills/code_minification.py
- Command line
-
hf download hf://AdminReal/NexusCoder/nexus/skills/code_minification.py
-
curl -L -o code_minification.py https://huggingface.co/AdminReal/NexusCoder/resolve/main/nexus/skills/code_minification.py
5.66 kB
| """Code Minification Skill - Minify JS/CSS/HTML/JSON. | |
| Strategy: remove whitespace + comments, mangle identifiers, collapse dead | |
| code, tree-shake unused exports. Sử dụng tool phù hợp per language. | |
| Author: Hieu Louis (2026) | |
| """ | |
| from __future__ import annotations | |
| from typing import Dict, List | |
| from .base import Skill, SkillContext, SkillCategory, SkillPriority, SkillResult | |
| class CodeMinificationSkill(Skill): | |
| """Minify code: JS, CSS, HTML, JSON. Giảm size, giữ semantic.""" | |
| category = SkillCategory.CODE | |
| priority = SkillPriority.LOW | |
| keywords: List[str] = [ | |
| "minify", "minification", "compress code", "uglify", | |
| "terser", "cssnano", "html minify", "nén code", | |
| "shrink", "reduce size", "bundle size", "tree shake", | |
| ] | |
| examples = [ | |
| "Minify this JavaScript file", | |
| "Compress this CSS to production size", | |
| "Uglify this JS preserving function names", | |
| ] | |
| def name(self) -> str: | |
| return "code_minification" | |
| def description(self) -> str: | |
| return ( | |
| "Minify JS/CSS/HTML/JSON: remove comments + whitespace, " | |
| "mangle identifiers, collapse dead code, tree-shake unused exports." | |
| ) | |
| def can_handle(self, prompt: str, context: SkillContext = None) -> float: | |
| prompt_lower = prompt.lower() | |
| score = 0.0 | |
| for kw in self.keywords: | |
| if kw in prompt_lower: | |
| score += 0.18 | |
| return min(1.0, score) | |
| def execute(self, context: SkillContext) -> SkillResult: | |
| lang = (context.language or "javascript").lower() | |
| return SkillResult( | |
| success=True, | |
| output=f"[CodeMinification/{lang}] Minification strategy + toolchain ready.", | |
| artifacts=[ | |
| {"path": "minify/strategy.md", "content": _MINIFY_STRATEGY}, | |
| {"path": "minify/example.txt", "content": _EXAMPLE_MINIFIED_JS}, | |
| ], | |
| metadata={ | |
| "skill": self.name, | |
| "language": lang, | |
| "toolchain": { | |
| "javascript": "terser --compress --mangle", | |
| "typescript": "tsc + terser (or esbuild)", | |
| "css": "cssnano / lightningcss (Rust, fastest)", | |
| "html": "html-minifier-terser", | |
| "json": "jq -c (lossless)", | |
| "python": "pyminifier (limited) — prefer zipapp + bytecode-only distribution", | |
| }, | |
| "techniques": [ | |
| "Whitespace removal (spaces, newlines, indentation)", | |
| "Comment stripping (// and /* */ and <!-- -->)", | |
| "Identifier mangling (shorter names: myVar -> a)", | |
| "Dead code elimination (unreachable statements)", | |
| "Tree shaking (drop unused exports)", | |
| "Constant folding (2+3 -> 5)", | |
| "Property mangling (only when --mangle-props)", | |
| "Hex/octal/unicode escape compression", | |
| "Boolean shortcut (true -> !0, false -> !1)", | |
| ], | |
| "trade_offs": { | |
| "size_vs_debuggability": "mangled names break stack traces — ship sourcemaps to Sentry", | |
| "size_vs_startup": "esbuild may produce slightly larger bundle but parses faster", | |
| "compression_vs_safety": "property mangling risky with bracket access", | |
| }, | |
| "best_practices": [ | |
| "Always emit sourcemaps (.map) and upload to error tracker", | |
| "Measure gzipped + brotli sizes, not raw bytes", | |
| "Use same minifier across build matrix to keep sourcemaps consistent", | |
| "Cache bust with content-hash filenames", | |
| ], | |
| }, | |
| suggestions=[ | |
| "Specify if source maps should be emitted", | |
| "Indicate if identifier mangling is safe (no eval, no bracket access)", | |
| "Check bundle budget (e.g. < 200 KB gzipped initial)", | |
| ], | |
| ) | |
| _MINIFY_STRATEGY = """# Minification Strategy | |
| ## Per-Language Pipeline | |
| ### JavaScript / TypeScript | |
| ```bash | |
| # terser CLI | |
| terser input.js \\\\ | |
| --compress passes=2,drop_console=true,drop_debugger=true \\\\ | |
| --mangle toplevel \\\\ | |
| --source-map url='out.js.map' \\\\ | |
| --output out.js | |
| ``` | |
| ### CSS | |
| ```bash | |
| # lightningcss (Rust, fastest) | |
| lightningcss --minify --bundle --targets 'defaults' input.css -o out.css | |
| ``` | |
| ### HTML | |
| ```bash | |
| html-minifier-terser \\\\ | |
| --collapse-whitespace --remove-comments \\\\ | |
| --minify-css true --minify-js true \\\\ | |
| input.html -o out.html | |
| ``` | |
| ### JSON (config files) | |
| ```bash | |
| jq -c . input.json > out.min.json | |
| ``` | |
| ## Bundle Budget | |
| - JS initial: < 200 KB gzipped | |
| - CSS initial: < 50 KB gzipped | |
| - Per-route lazy chunk: < 50 KB gzipped | |
| ## Pitfalls | |
| - Mangled property names break `obj['dynamicProp']` access. | |
| - Drop `console.log` only in production — keep in staging for tracing. | |
| - Inline `<script>` minified by HTML minifier may conflict with CSP nonces. | |
| """ | |
| _EXAMPLE_MINIFIED_JS = """// ---- Before ---- | |
| function calculateTotal(items, taxRate) { | |
| // Sum item prices | |
| let subtotal = 0; | |
| for (let i = 0; i < items.length; i++) { | |
| subtotal += items[i].price * items[i].quantity; | |
| } | |
| const tax = subtotal * taxRate; | |
| return subtotal + tax; | |
| } | |
| // ---- After (terser --compress --mangle) ---- | |
| function calculateTotal(a,b){let c=0;for(let d=0;d<a.length;d++)c+=a[d].price*a[d].quantity;return c+c*b} | |
| // Size: 274 -> 119 bytes (-57%). Gzipped: 158 -> 96 bytes (-39%). | |
| """ | |