Text Generation
GGUF
llama.cpp
pocketpal
on-device
Mixture of Experts
multilingual
quantization
distillation
1-bit
2-bit
3-bit
conversational
Instructions to use RegalInvader/Marco-Nano-Instruct-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use RegalInvader/Marco-Nano-Instruct-GGUF with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf RegalInvader/Marco-Nano-Instruct-GGUF:TQ1_0 # Run inference directly in the terminal: llama cli -hf RegalInvader/Marco-Nano-Instruct-GGUF:TQ1_0
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf RegalInvader/Marco-Nano-Instruct-GGUF:TQ1_0 # Run inference directly in the terminal: llama cli -hf RegalInvader/Marco-Nano-Instruct-GGUF:TQ1_0
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf RegalInvader/Marco-Nano-Instruct-GGUF:TQ1_0 # Run inference directly in the terminal: ./build/bin/llama cli -hf RegalInvader/Marco-Nano-Instruct-GGUF:TQ1_0
Use Docker
docker model run hf.co/RegalInvader/Marco-Nano-Instruct-GGUF:TQ1_0
- Llama new
- LM Studio
- Jan
- vLLM
How to use RegalInvader/Marco-Nano-Instruct-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "RegalInvader/Marco-Nano-Instruct-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RegalInvader/Marco-Nano-Instruct-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/RegalInvader/Marco-Nano-Instruct-GGUF:TQ1_0
- Ollama
How to use RegalInvader/Marco-Nano-Instruct-GGUF with Ollama:
ollama run hf.co/RegalInvader/Marco-Nano-Instruct-GGUF:TQ1_0
- Unsloth Desktop
- Pi
How to use RegalInvader/Marco-Nano-Instruct-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf RegalInvader/Marco-Nano-Instruct-GGUF:TQ1_0
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "RegalInvader/Marco-Nano-Instruct-GGUF:TQ1_0" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use RegalInvader/Marco-Nano-Instruct-GGUF with Docker Model Runner:
docker model run hf.co/RegalInvader/Marco-Nano-Instruct-GGUF:TQ1_0
- Lemonade
How to use RegalInvader/Marco-Nano-Instruct-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull RegalInvader/Marco-Nano-Instruct-GGUF:TQ1_0
Run and chat with the model
lemonade run user.Marco-Nano-Instruct-GGUF-TQ1_0
List all available models
lemonade list
- Hermes Agent
How to use RegalInvader/Marco-Nano-Instruct-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf RegalInvader/Marco-Nano-Instruct-GGUF:TQ1_0
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default RegalInvader/Marco-Nano-Instruct-GGUF:TQ1_0
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use RegalInvader/Marco-Nano-Instruct-GGUF with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf RegalInvader/Marco-Nano-Instruct-GGUF:TQ1_0
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "RegalInvader/Marco-Nano-Instruct-GGUF:TQ1_0" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
File size: 3,272 Bytes
e5235fb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | """The one model wrapper every eval goes through (spec §7, T0.3).
lm-evaluation-harness's HF model, registered as `marco`, with three additions:
- a quantisation switch: `quant=off` (the model as loaded) or `quant=ternary` (routed experts replaced
in place by their ternary fake-quant, spec §4: Q-A absmean, g128 by default) — the PTQ view of a
checkpoint without exporting it;
- a loader hook for packed students, `packed=<dir>` (filled in T2.6: codes + scales → expert weights);
- stop tokens: generation stops on both `<|im_end|>` and `<|endoftext|>`, because Marco's
generation_config.json lists only the latter while every chat turn ends with the former (D-12).
Use: `lm_eval --model marco --model_args pretrained=...,quant=ternary --include_path configs/eval/lm_eval_tasks`.
"""
from __future__ import annotations
import torch
from lm_eval.api.registry import register_model
from lm_eval.models.huggingface import HFLM
from lowbit.quant.ternary import QuantSpec, fake_quant
STOP_TOKENS = ("<|im_end|>", "<|endoftext|>")
def routed_expert_params(model: torch.nn.Module):
"""(name, parameter) for every routed-expert weight: the fused [E, out, in] tensors of transformers 5
(`experts.gate_up_proj`, `experts.down_proj`) or per-expert Linear weights in older layouts."""
for name, p in model.named_parameters():
if ".mlp.experts." in name and name.endswith(("gate_up_proj", "down_proj", "gate_proj.weight",
"up_proj.weight", "down_proj.weight")):
yield name, p
@torch.no_grad()
def ternarise_experts(model: torch.nn.Module, spec: QuantSpec) -> int:
"""Replace routed-expert weights by s * q in place (groups along the input dim); returns #weights."""
n = 0
for _, p in routed_expert_params(model):
p.copy_(fake_quant(p.data.float(), spec).to(p.dtype))
n += p.numel()
return n
def load_packed(model: torch.nn.Module, path: str) -> None:
raise NotImplementedError("packed-student loading is T2.6")
@register_model("marco")
class MarcoLM(HFLM):
def __init__(self, pretrained: str, quant: str = "off", packed: str | None = None,
quant_method: str = "absmean", group_size: int = 128, **kwargs):
super().__init__(pretrained=pretrained, **kwargs)
if quant not in ("off", "ternary"):
raise ValueError(f"quant must be off or ternary, got {quant!r}")
self.quant, self.packed = quant, packed
if packed:
load_packed(self.model, packed)
if quant == "ternary":
n = ternarise_experts(self.model, QuantSpec(method=quant_method, group_size=int(group_size)))
if n == 0:
raise ValueError("quant=ternary but the model has no routed-expert weights")
stop_ids = [self.tokenizer.convert_tokens_to_ids(t) for t in STOP_TOKENS]
self.stop_token_ids = [i for i in stop_ids if isinstance(i, int) and i >= 0]
def _model_generate(self, context, max_length, stop, **generation_kwargs):
generation_kwargs.setdefault("eos_token_id", self.stop_token_ids)
stop = list(dict.fromkeys([*stop, *STOP_TOKENS]))
return super()._model_generate(context, max_length, stop, **generation_kwargs)
|