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"
Download code/scripts/tq1_repack.py from RegalInvader/Marco-Nano-Instruct-GGUF: direct link, hf CLI and curl.
- Browser
- Download file 3.14 kB
-
https://huggingface.co/RegalInvader/Marco-Nano-Instruct-GGUF/resolve/main/code/scripts/tq1_repack.py
- Command line
-
hf download hf://RegalInvader/Marco-Nano-Instruct-GGUF/code/scripts/tq1_repack.py
-
curl -L -o tq1_repack.py https://huggingface.co/RegalInvader/Marco-Nano-Instruct-GGUF/resolve/main/code/scripts/tq1_repack.py
3.14 kB
| #!/usr/bin/env python3 | |
| """Repack a student GGUF's expert gate/up tensors from Q2_0 to llama.cpp's TQ1_0 (1.69 bits per weight). | |
| python scripts/tq1_repack.py <in.gguf> <out.gguf> | |
| TQ1_0 holds ternary codes for blocks of 256 weights with ONE fp16 scale, and needs rows whose length is a | |
| multiple of 256. Our groups are 128 wide with their own scales, so each TQ1_0 block covers two groups: | |
| - the trained codes are kept exactly; | |
| - the block's scale is the least-squares fit to both groups' values, mean |w| over its nonzero codes; | |
| - ffn_down_exps (rows of 384) cannot be TQ1_0 and stays Q2_0, as does everything else. | |
| Prints the size change and the scale approximation's relative weight error. | |
| """ | |
| from __future__ import annotations | |
| import json | |
| import sys | |
| from pathlib import Path | |
| import numpy as np | |
| REPO = Path(__file__).resolve().parent.parent | |
| sys.path.insert(0, str(REPO / "src")) | |
| from lowbit.export.gguf import dequant_q2_0, gguf_module, write_gguf # noqa: E402 | |
| LLAMA = Path("/path/to/llama.cpp") | |
| TQ_BLOCK = 256 | |
| def to_tq1(raw: np.ndarray, gguf) -> tuple[np.ndarray, float]: | |
| """Q2_0 bytes [..., nb · 18] → TQ1_0 bytes [..., cols / 256 · 54], and the relative L2 weight error.""" | |
| lead = raw.shape[:-1] | |
| w = dequant_q2_0(raw) # [..., cols] float32, codes · group scale | |
| cols = w.shape[-1] | |
| if cols % TQ_BLOCK: | |
| raise ValueError(f"rows of {cols} are not a multiple of {TQ_BLOCK}") | |
| blk = w.reshape(-1, TQ_BLOCK) | |
| nz = blk != 0 | |
| d = np.abs(blk).sum(-1) / np.maximum(nz.sum(-1), 1) # least squares with the codes fixed | |
| codes = np.sign(blk) | |
| x = (codes * d[:, None]).astype(np.float32) # TQ1_0's own quantiser then keeps d and the codes | |
| err = float(np.linalg.norm(x - blk) / max(np.linalg.norm(blk), 1e-30)) | |
| q = gguf.quants.quantize(x.reshape(*lead, cols), gguf.GGMLQuantizationType.TQ1_0) | |
| back = gguf.quants.dequantize(q, gguf.GGMLQuantizationType.TQ1_0).reshape(-1, TQ_BLOCK) | |
| if not np.array_equal(np.sign(back), codes): | |
| raise RuntimeError("TQ1_0 changed a code") | |
| return q, err | |
| def main() -> None: | |
| src, dst = sys.argv[1], sys.argv[2] | |
| gguf = gguf_module(LLAMA) | |
| r = gguf.GGUFReader(src) | |
| T = gguf.GGMLQuantizationType | |
| tensors, errs, moved = {}, [], 0 | |
| for t in r.tensors: | |
| data = np.asarray(t.data) | |
| if t.tensor_type == T.Q2_0 and (t.name.endswith("ffn_gate_exps.weight") or t.name.endswith("ffn_up_exps.weight")): | |
| q, e = to_tq1(data, gguf) | |
| tensors[t.name] = (T.TQ1_0, q) | |
| errs.append(e) | |
| moved += data.nbytes - q.nbytes | |
| else: | |
| tensors[t.name] = (t.tensor_type, data) | |
| info = write_gguf(src, dst, tensors, gguf) | |
| out = {"in_bytes": Path(src).stat().st_size, "out_bytes": info["bytes"], | |
| "saved_pct": round(100 * (1 - info["bytes"] / Path(src).stat().st_size), 1), | |
| "tq1_tensors": len(errs), "scale_rel_err_mean": round(float(np.mean(errs)), 4), | |
| "scale_rel_err_max": round(float(np.max(errs)), 4)} | |
| print(json.dumps(out, indent=1)) | |
| if __name__ == "__main__": | |
| main() | |