How to use from
llama.cpp
Install from brew
brew install llama.cpp
# Start a local OpenAI-compatible server with a web UI:
llama-server -hf joehiggi/gcode-specialist-3b:Q4_K_M
# Run inference directly in the terminal:
llama-cli -hf joehiggi/gcode-specialist-3b:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp
# Start a local OpenAI-compatible server with a web UI:
llama-server -hf joehiggi/gcode-specialist-3b:Q4_K_M
# Run inference directly in the terminal:
llama-cli -hf joehiggi/gcode-specialist-3b:Q4_K_M
Use pre-built binary
# Download pre-built binary from:
# https://github.com/ggerganov/llama.cpp/releases
# Start a local OpenAI-compatible server with a web UI:
./llama-server -hf joehiggi/gcode-specialist-3b:Q4_K_M
# Run inference directly in the terminal:
./llama-cli -hf joehiggi/gcode-specialist-3b:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
cmake -B build
cmake --build build -j --target llama-server llama-cli
# Start a local OpenAI-compatible server with a web UI:
./build/bin/llama-server -hf joehiggi/gcode-specialist-3b:Q4_K_M
# Run inference directly in the terminal:
./build/bin/llama-cli -hf joehiggi/gcode-specialist-3b:Q4_K_M
Use Docker
docker model run hf.co/joehiggi/gcode-specialist-3b:Q4_K_M
Quick Links

gcode-specialist-3b

LoRA fine-tune of bigcode/starcoder2-3b on 709 prompt to G-code pairs (CNC milling / drilling operations across RS274/NGC, Fanuc, Haas, Siemens, Grbl dialects). Exported to Q4_K_M GGUF for in-process inference via llama-cpp-python on the g-gen HF Space.

Hyperparameters

  • LoRA rank: 16, alpha: 32, dropout: 0.05
  • target_modules: q_proj, k_proj, v_proj, o_proj, c_fc, c_proj
  • max_seq_len: 2048, batch: 1 x 16 grad-accum
  • epochs: 3, lr: 0.0002 (cosine, 10 warmup steps)
  • 4-bit NF4 base via bitsandbytes, fp16 compute

Prompt format

<|system|>
You are a CNC G-code expert. Given a natural language description of a machining operation, output only valid G-code with no explanation, no markdown, and no prose. Each line must be a valid G-code block.
<|user|>
<your machining description>
<|assistant|>
<G-code>

Inference (llama-cpp-python)

from llama_cpp import Llama
llm = Llama(model_path="gcode-specialist-q4_k_m.gguf", n_ctx=2048)
out = llm.create_completion(
    "<|system|>\n" + SYSTEM_PROMPT + "\n<|user|>\nDrill 4 holes...\n<|assistant|>\n",
    max_tokens=512, stop=["M30\n", "<|user|>"],
)
print(out["choices"][0]["text"])
Downloads last month
82
GGUF
Model size
3B params
Architecture
starcoder2
Hardware compatibility
Log In to add your hardware

4-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for joehiggi/gcode-specialist-3b

Adapter
(302)
this model