Text Generation
llama-cpp-python
GGUF
English
code-generation
coding-assistant
llama.cpp
qwen2.5
python
javascript
fine-tuned
conversational
Instructions to use neuralbroker/blitzkode with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use neuralbroker/blitzkode with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="neuralbroker/blitzkode", filename="blitzkode.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - llama-cpp-python
How to use neuralbroker/blitzkode with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="neuralbroker/blitzkode", filename="blitzkode.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use neuralbroker/blitzkode with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf neuralbroker/blitzkode # Run inference directly in the terminal: llama-cli -hf neuralbroker/blitzkode
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf neuralbroker/blitzkode # Run inference directly in the terminal: llama-cli -hf neuralbroker/blitzkode
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 neuralbroker/blitzkode # Run inference directly in the terminal: ./llama-cli -hf neuralbroker/blitzkode
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 neuralbroker/blitzkode # Run inference directly in the terminal: ./build/bin/llama-cli -hf neuralbroker/blitzkode
Use Docker
docker model run hf.co/neuralbroker/blitzkode
- LM Studio
- Jan
- vLLM
How to use neuralbroker/blitzkode with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "neuralbroker/blitzkode" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "neuralbroker/blitzkode", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/neuralbroker/blitzkode
- Ollama
How to use neuralbroker/blitzkode with Ollama:
ollama run hf.co/neuralbroker/blitzkode
- Unsloth Studio new
How to use neuralbroker/blitzkode with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for neuralbroker/blitzkode to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for neuralbroker/blitzkode to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for neuralbroker/blitzkode to start chatting
- Pi new
How to use neuralbroker/blitzkode with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf neuralbroker/blitzkode
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "neuralbroker/blitzkode" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use neuralbroker/blitzkode with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf neuralbroker/blitzkode
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 neuralbroker/blitzkode
Run Hermes
hermes
- Docker Model Runner
How to use neuralbroker/blitzkode with Docker Model Runner:
docker model run hf.co/neuralbroker/blitzkode
- Lemonade
How to use neuralbroker/blitzkode with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull neuralbroker/blitzkode
Run and chat with the model
lemonade run user.blitzkode-{{QUANT_TAG}}List all available models
lemonade list
| #!/usr/bin/env python3 | |
| """Merge LoRA adapter β HuggingFace model β GGUF (blitzkode.gguf). | |
| Pipeline | |
| -------- | |
| 1. Load base model + LoRA adapter, merge and unload adapters. | |
| 2. Save merged HuggingFace model to <output_dir>/merged/. | |
| 3. Download llama.cpp convert_hf_to_gguf.py from GitHub if not present. | |
| 4. Run GGUF conversion (quantised Q4_K_M by default). | |
| 5. Verify the output GGUF is loadable with llama-cpp-python. | |
| """ | |
| from __future__ import annotations | |
| import argparse | |
| import json | |
| import subprocess | |
| import sys | |
| import urllib.request | |
| from pathlib import Path | |
| REPO_ROOT = Path(__file__).resolve().parents[1] | |
| DEFAULT_CHECKPOINT = REPO_ROOT / "checkpoints" / "blitzkode-1.5b-lora" / "final" | |
| DEFAULT_MERGED_DIR = REPO_ROOT / "exported" / "merged" | |
| DEFAULT_GGUF_OUT = REPO_ROOT / "blitzkode.gguf" | |
| LLAMA_CPP_SCRIPTS_DIR = REPO_ROOT / "llama.cpp" | |
| CONVERT_SCRIPT_URL = ( | |
| "https://raw.githubusercontent.com/ggerganov/llama.cpp/master/convert_hf_to_gguf.py" | |
| ) | |
| def parse_args() -> argparse.Namespace: | |
| p = argparse.ArgumentParser(description=__doc__) | |
| p.add_argument("--checkpoint", type=Path, default=DEFAULT_CHECKPOINT) | |
| p.add_argument("--merged-dir", type=Path, default=DEFAULT_MERGED_DIR) | |
| p.add_argument("--gguf-out", type=Path, default=DEFAULT_GGUF_OUT) | |
| p.add_argument("--quant-type", default="q4_k_m", help="GGUF quantisation type (q4_k_m, q8_0, f16, β¦)") | |
| p.add_argument("--skip-merge", action="store_true", help="Skip merge step; use --merged-dir as-is.") | |
| p.add_argument("--skip-gguf", action="store_true", help="Skip GGUF conversion (only merge).") | |
| p.add_argument("--verify", action="store_true", default=True, help="Verify GGUF is loadable (default: on).") | |
| p.add_argument("--no-verify", dest="verify", action="store_false") | |
| return p.parse_args() | |
| # βββ Step 1: Merge ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| def merge_adapter(checkpoint: Path, merged_dir: Path) -> None: | |
| print("\n[1/3] Merging LoRA adapter into base model β¦") | |
| import torch # noqa: PLC0415 | |
| from peft import PeftModel # noqa: PLC0415 | |
| from transformers import AutoModelForCausalLM, AutoTokenizer # noqa: PLC0415 | |
| config_path = checkpoint / "adapter_config.json" | |
| if not config_path.exists(): | |
| raise SystemExit(f"adapter_config.json not found: {config_path}") | |
| with config_path.open() as fh: | |
| adapter_config = json.load(fh) | |
| base_name = adapter_config["base_model_name_or_path"] | |
| print(f" Checkpoint : {checkpoint}") | |
| print(f" Base model : {base_name}") | |
| dtype = torch.float16 | |
| print(" Loading base model β¦") | |
| base = AutoModelForCausalLM.from_pretrained( | |
| base_name, | |
| dtype=dtype, | |
| device_map="cpu", | |
| trust_remote_code=True, | |
| ) | |
| tokenizer = AutoTokenizer.from_pretrained(str(checkpoint), trust_remote_code=True) | |
| print(" Loading & merging adapter β¦") | |
| model = PeftModel.from_pretrained(base, str(checkpoint)) | |
| model = model.merge_and_unload() | |
| merged_dir.mkdir(parents=True, exist_ok=True) | |
| print(f" Saving merged model to {merged_dir} β¦") | |
| model.save_pretrained(str(merged_dir)) | |
| tokenizer.save_pretrained(str(merged_dir)) | |
| print(" Merge complete.") | |
| # βββ Step 2: Download convert script βββββββββββββββββββββββββββββββββββββββββ | |
| def ensure_convert_script() -> Path: | |
| LLAMA_CPP_SCRIPTS_DIR.mkdir(parents=True, exist_ok=True) | |
| convert_script = LLAMA_CPP_SCRIPTS_DIR / "convert_hf_to_gguf.py" | |
| if not convert_script.exists(): | |
| print(f"\n Downloading convert_hf_to_gguf.py from llama.cpp GitHub β¦") | |
| try: | |
| req = urllib.request.Request(CONVERT_SCRIPT_URL, headers={"User-Agent": "BlitzKode/2.0"}) | |
| with urllib.request.urlopen(req, timeout=60) as response: | |
| content = response.read() | |
| convert_script.write_bytes(content) | |
| print(f" Saved to: {convert_script}") | |
| except Exception as exc: | |
| raise SystemExit(f"Failed to download convert_hf_to_gguf.py: {exc}") from exc | |
| else: | |
| print(f"\n Using cached: {convert_script}") | |
| return convert_script | |
| # βββ Step 3: GGUF conversion ββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| def convert_to_gguf(merged_dir: Path, gguf_out: Path, quant_type: str) -> None: | |
| print(f"\n[2/3] Converting to GGUF ({quant_type}) β¦") | |
| convert_script = ensure_convert_script() | |
| cmd = [ | |
| sys.executable, | |
| str(convert_script), | |
| str(merged_dir), | |
| "--outfile", | |
| str(gguf_out), | |
| "--outtype", | |
| quant_type, | |
| ] | |
| print(f" Running: {' '.join(cmd)}") | |
| result = subprocess.run(cmd, capture_output=False, text=True) | |
| if result.returncode != 0: | |
| raise SystemExit(f"GGUF conversion failed (exit code {result.returncode}).") | |
| print(f" GGUF written: {gguf_out} ({gguf_out.stat().st_size / 1024**3:.2f} GB)") | |
| # βββ Step 4: Verify βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| def verify_gguf(gguf_path: Path) -> None: | |
| print(f"\n[3/3] Verifying GGUF with llama-cpp-python β¦") | |
| try: | |
| import llama_cpp # noqa: PLC0415 | |
| llm = llama_cpp.Llama( | |
| model_path=str(gguf_path), | |
| n_ctx=128, | |
| n_threads=2, | |
| n_gpu_layers=0, | |
| verbose=False, | |
| ) | |
| prompt = "<|im_start|>user\nSay hello.<|im_end|>\n<|im_start|>assistant\n" | |
| out = llm(prompt, max_tokens=8, stop=["<|im_end|>"]) | |
| text = out["choices"][0]["text"].strip() | |
| print(f" Sample output: {text!r}") | |
| print(" Verification PASSED.") | |
| except Exception as exc: | |
| print(f" [WARN] Verification raised: {exc}") | |
| print(" GGUF was written; manual verification recommended.") | |
| # βββ Main βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| def main() -> None: | |
| args = parse_args() | |
| print("=" * 72) | |
| print("BLITZKODE PRODUCTION EXPORT") | |
| print("=" * 72) | |
| if not args.skip_merge: | |
| merge_adapter(args.checkpoint, args.merged_dir) | |
| else: | |
| print("\n[1/3] Merge skipped (--skip-merge).") | |
| if not args.merged_dir.exists(): | |
| raise SystemExit(f"Merged dir not found: {args.merged_dir}") | |
| if not args.skip_gguf: | |
| convert_to_gguf(args.merged_dir, args.gguf_out, args.quant_type) | |
| else: | |
| print("\n[2/3] GGUF conversion skipped (--skip-gguf).") | |
| if args.verify and args.gguf_out.exists(): | |
| verify_gguf(args.gguf_out) | |
| print("\n" + "=" * 72) | |
| print("EXPORT COMPLETE") | |
| print(f" Merged HF model : {args.merged_dir}") | |
| if args.gguf_out.exists(): | |
| print(f" GGUF model : {args.gguf_out}") | |
| print("\nNext steps:") | |
| print(" python scripts/push_to_hub.py") | |
| print(" python server.py") | |
| if __name__ == "__main__": | |
| main() | |