Instructions to use build-small-hackathon/codeflow-qwen-3-finetuning with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use build-small-hackathon/codeflow-qwen-3-finetuning with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="build-small-hackathon/codeflow-qwen-3-finetuning", filename="qwen3-coder-codeflow-Q3_K_L.gguf", )
llm.create_chat_completion( messages = "No input example has been defined for this model task." )
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use build-small-hackathon/codeflow-qwen-3-finetuning 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 build-small-hackathon/codeflow-qwen-3-finetuning:Q3_K_L # Run inference directly in the terminal: llama cli -hf build-small-hackathon/codeflow-qwen-3-finetuning:Q3_K_L
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf build-small-hackathon/codeflow-qwen-3-finetuning:Q3_K_L # Run inference directly in the terminal: llama cli -hf build-small-hackathon/codeflow-qwen-3-finetuning:Q3_K_L
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 build-small-hackathon/codeflow-qwen-3-finetuning:Q3_K_L # Run inference directly in the terminal: ./llama-cli -hf build-small-hackathon/codeflow-qwen-3-finetuning:Q3_K_L
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 build-small-hackathon/codeflow-qwen-3-finetuning:Q3_K_L # Run inference directly in the terminal: ./build/bin/llama-cli -hf build-small-hackathon/codeflow-qwen-3-finetuning:Q3_K_L
Use Docker
docker model run hf.co/build-small-hackathon/codeflow-qwen-3-finetuning:Q3_K_L
- LM Studio
- Jan
- Ollama
How to use build-small-hackathon/codeflow-qwen-3-finetuning with Ollama:
ollama run hf.co/build-small-hackathon/codeflow-qwen-3-finetuning:Q3_K_L
- Unsloth Studio
How to use build-small-hackathon/codeflow-qwen-3-finetuning 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 build-small-hackathon/codeflow-qwen-3-finetuning 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 build-small-hackathon/codeflow-qwen-3-finetuning to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for build-small-hackathon/codeflow-qwen-3-finetuning to start chatting
- Pi
How to use build-small-hackathon/codeflow-qwen-3-finetuning with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf build-small-hackathon/codeflow-qwen-3-finetuning:Q3_K_L
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": "build-small-hackathon/codeflow-qwen-3-finetuning:Q3_K_L" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use build-small-hackathon/codeflow-qwen-3-finetuning with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf build-small-hackathon/codeflow-qwen-3-finetuning:Q3_K_L
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 build-small-hackathon/codeflow-qwen-3-finetuning:Q3_K_L
Run Hermes
hermes
- Atomic Chat new
- OpenClaw new
How to use build-small-hackathon/codeflow-qwen-3-finetuning with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf build-small-hackathon/codeflow-qwen-3-finetuning:Q3_K_L
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 "build-small-hackathon/codeflow-qwen-3-finetuning:Q3_K_L" \ --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"
- Docker Model Runner
How to use build-small-hackathon/codeflow-qwen-3-finetuning with Docker Model Runner:
docker model run hf.co/build-small-hackathon/codeflow-qwen-3-finetuning:Q3_K_L
- Lemonade
How to use build-small-hackathon/codeflow-qwen-3-finetuning with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull build-small-hackathon/codeflow-qwen-3-finetuning:Q3_K_L
Run and chat with the model
lemonade run user.codeflow-qwen-3-finetuning-Q3_K_L
List all available models
lemonade list
Commit ·
2b8e4a2
1
Parent(s): 5c99c3d
Added a kaggle notebook for training
Browse files
notebooks/qwen3_coder_codeflow_gguf_to_kaggle.ipynb
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
+
"metadata": {},
|
| 6 |
+
"source": [
|
| 7 |
+
"# Fine-tune Qwen3-Coder and Upload Q3_K_XL GGUF to Kaggle\n",
|
| 8 |
+
"\n",
|
| 9 |
+
"This notebook runs the repo's QLoRA fine-tune, exports `out/qwen3-coder-codeflow-Q3_K_XL.gguf`, and uploads it to Kaggle as a dataset.\n",
|
| 10 |
+
"\n",
|
| 11 |
+
"Use a high-memory GPU runtime. A free T4/L4 Colab runtime is unlikely to have enough VRAM/RAM/disk for the 30B merge/export step. A100/H100-class runtime with high system RAM is the safer target.\n",
|
| 12 |
+
"\n",
|
| 13 |
+
"Before running the Kaggle upload cell, add these Colab Secrets:\n",
|
| 14 |
+
"\n",
|
| 15 |
+
"- `KAGGLE_USERNAME`\n",
|
| 16 |
+
"- `KAGGLE_KEY`\n",
|
| 17 |
+
"\n",
|
| 18 |
+
"Do not paste your Kaggle API key into the notebook itself."
|
| 19 |
+
]
|
| 20 |
+
},
|
| 21 |
+
{
|
| 22 |
+
"cell_type": "code",
|
| 23 |
+
"execution_count": null,
|
| 24 |
+
"metadata": {},
|
| 25 |
+
"outputs": [],
|
| 26 |
+
"source": [
|
| 27 |
+
"# Check GPU and disk before doing the expensive work.\n",
|
| 28 |
+
"!nvidia-smi\n",
|
| 29 |
+
"!df -h /content\n",
|
| 30 |
+
"!free -h"
|
| 31 |
+
]
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"cell_type": "code",
|
| 35 |
+
"execution_count": null,
|
| 36 |
+
"metadata": {},
|
| 37 |
+
"outputs": [],
|
| 38 |
+
"source": [
|
| 39 |
+
"# Clone the repo. If you uploaded this notebook inside an already-cloned repo,\n",
|
| 40 |
+
"# skip this cell and set REPO_DIR to that path instead.\n",
|
| 41 |
+
"REPO_URL = \"https://github.com/rishijain27/codeflow-qwen-3-finetuning.git\"\n",
|
| 42 |
+
"REPO_DIR = \"/content/codeflow-qwen-3-finetuning\"\n",
|
| 43 |
+
"\n",
|
| 44 |
+
"import os\n",
|
| 45 |
+
"\n",
|
| 46 |
+
"if not os.path.exists(REPO_DIR):\n",
|
| 47 |
+
" !git clone {REPO_URL} {REPO_DIR}\n",
|
| 48 |
+
"else:\n",
|
| 49 |
+
" print(f\"Repo already exists at {REPO_DIR}\")\n",
|
| 50 |
+
"\n",
|
| 51 |
+
"%cd {REPO_DIR}"
|
| 52 |
+
]
|
| 53 |
+
},
|
| 54 |
+
{
|
| 55 |
+
"cell_type": "code",
|
| 56 |
+
"execution_count": null,
|
| 57 |
+
"metadata": {},
|
| 58 |
+
"outputs": [],
|
| 59 |
+
"source": [
|
| 60 |
+
"# System build tools for llama.cpp. CUDA is provided by the Colab runtime.\n",
|
| 61 |
+
"!apt-get update\n",
|
| 62 |
+
"!apt-get install -y git build-essential ninja-build"
|
| 63 |
+
]
|
| 64 |
+
},
|
| 65 |
+
{
|
| 66 |
+
"cell_type": "code",
|
| 67 |
+
"execution_count": null,
|
| 68 |
+
"metadata": {},
|
| 69 |
+
"outputs": [],
|
| 70 |
+
"source": [
|
| 71 |
+
"# Create and populate the repo-local venv.\n",
|
| 72 |
+
"!python3 -m venv .venv\n",
|
| 73 |
+
"!.venv/bin/python -m pip install -U pip setuptools wheel\n",
|
| 74 |
+
"!.venv/bin/python -m pip install -r requirements.txt\n",
|
| 75 |
+
"!.venv/bin/python -m pip install kaggle"
|
| 76 |
+
]
|
| 77 |
+
},
|
| 78 |
+
{
|
| 79 |
+
"cell_type": "code",
|
| 80 |
+
"execution_count": null,
|
| 81 |
+
"metadata": {},
|
| 82 |
+
"outputs": [],
|
| 83 |
+
"source": [
|
| 84 |
+
"# Optional dry run: validates tokenization and dataset formatting without loading the 30B model.\n",
|
| 85 |
+
"!.venv/bin/python finetune.py --dry-run"
|
| 86 |
+
]
|
| 87 |
+
},
|
| 88 |
+
{
|
| 89 |
+
"cell_type": "code",
|
| 90 |
+
"execution_count": null,
|
| 91 |
+
"metadata": {},
|
| 92 |
+
"outputs": [],
|
| 93 |
+
"source": [
|
| 94 |
+
"# Fine-tune, merge, auto-build llama.cpp under .venv/llama.cpp if needed, and export Q3_K_XL GGUF.\n",
|
| 95 |
+
"# This is the long-running step.\n",
|
| 96 |
+
"!.venv/bin/python finetune.py \\\n",
|
| 97 |
+
" --model Qwen/Qwen3-Coder-30B-A3B-Instruct \\\n",
|
| 98 |
+
" --4bit \\\n",
|
| 99 |
+
" --epochs 3 \\\n",
|
| 100 |
+
" --batch-size 1 \\\n",
|
| 101 |
+
" --grad-accum 16 \\\n",
|
| 102 |
+
" --max-seq-len 2048 \\\n",
|
| 103 |
+
" --output-dir out/qwen-mermaid-lora \\\n",
|
| 104 |
+
" --merge-dir out/qwen-mermaid-merged \\\n",
|
| 105 |
+
" --merge-device-map cpu \\\n",
|
| 106 |
+
" --export-gguf \\\n",
|
| 107 |
+
" --gguf-out out/qwen3-coder-codeflow-Q3_K_XL.gguf \\\n",
|
| 108 |
+
" --gguf-quant Q3_K_XL"
|
| 109 |
+
]
|
| 110 |
+
},
|
| 111 |
+
{
|
| 112 |
+
"cell_type": "code",
|
| 113 |
+
"execution_count": null,
|
| 114 |
+
"metadata": {},
|
| 115 |
+
"outputs": [],
|
| 116 |
+
"source": [
|
| 117 |
+
"# Verify the GGUF exists.\n",
|
| 118 |
+
"!ls -lh out/qwen3-coder-codeflow-Q3_K_XL.gguf"
|
| 119 |
+
]
|
| 120 |
+
},
|
| 121 |
+
{
|
| 122 |
+
"cell_type": "code",
|
| 123 |
+
"execution_count": null,
|
| 124 |
+
"metadata": {},
|
| 125 |
+
"outputs": [],
|
| 126 |
+
"source": [
|
| 127 |
+
"# Configure Kaggle credentials from Colab Secrets.\n",
|
| 128 |
+
"from google.colab import userdata\n",
|
| 129 |
+
"import json\n",
|
| 130 |
+
"import os\n",
|
| 131 |
+
"from pathlib import Path\n",
|
| 132 |
+
"\n",
|
| 133 |
+
"kaggle_username = userdata.get(\"KAGGLE_USERNAME\")\n",
|
| 134 |
+
"kaggle_key = userdata.get(\"KAGGLE_KEY\")\n",
|
| 135 |
+
"if not kaggle_username or not kaggle_key:\n",
|
| 136 |
+
" raise RuntimeError(\"Add KAGGLE_USERNAME and KAGGLE_KEY in Colab Secrets before running this cell.\")\n",
|
| 137 |
+
"\n",
|
| 138 |
+
"kaggle_dir = Path.home() / \".kaggle\"\n",
|
| 139 |
+
"kaggle_dir.mkdir(parents=True, exist_ok=True)\n",
|
| 140 |
+
"kaggle_json = kaggle_dir / \"kaggle.json\"\n",
|
| 141 |
+
"kaggle_json.write_text(json.dumps({\"username\": kaggle_username, \"key\": kaggle_key}))\n",
|
| 142 |
+
"kaggle_json.chmod(0o600)\n",
|
| 143 |
+
"print(f\"Configured Kaggle credentials for {kaggle_username}\")"
|
| 144 |
+
]
|
| 145 |
+
},
|
| 146 |
+
{
|
| 147 |
+
"cell_type": "code",
|
| 148 |
+
"execution_count": null,
|
| 149 |
+
"metadata": {},
|
| 150 |
+
"outputs": [],
|
| 151 |
+
"source": [
|
| 152 |
+
"# Stage the GGUF and Kaggle dataset metadata.\n",
|
| 153 |
+
"import json\n",
|
| 154 |
+
"import shutil\n",
|
| 155 |
+
"from pathlib import Path\n",
|
| 156 |
+
"\n",
|
| 157 |
+
"upload_dir = Path(\"kaggle_upload\")\n",
|
| 158 |
+
"upload_dir.mkdir(exist_ok=True)\n",
|
| 159 |
+
"gguf_src = Path(\"out/qwen3-coder-codeflow-Q3_K_XL.gguf\")\n",
|
| 160 |
+
"gguf_dst = upload_dir / gguf_src.name\n",
|
| 161 |
+
"if not gguf_src.exists():\n",
|
| 162 |
+
" raise FileNotFoundError(gguf_src)\n",
|
| 163 |
+
"if not gguf_dst.exists():\n",
|
| 164 |
+
" shutil.copy2(gguf_src, gguf_dst)\n",
|
| 165 |
+
"\n",
|
| 166 |
+
"metadata = {\n",
|
| 167 |
+
" \"title\": \"Qwen3 Coder CodeFlow Q3_K_XL GGUF\",\n",
|
| 168 |
+
" \"id\": \"rishijain27/qwen3-coder-codeflow-q3-k-xl-gguf\",\n",
|
| 169 |
+
" \"licenses\": [{\"name\": \"other\"}],\n",
|
| 170 |
+
"}\n",
|
| 171 |
+
"(upload_dir / \"dataset-metadata.json\").write_text(json.dumps(metadata, indent=2))\n",
|
| 172 |
+
"print(f\"Staged files in {upload_dir.resolve()}\")\n",
|
| 173 |
+
"!ls -lh kaggle_upload"
|
| 174 |
+
]
|
| 175 |
+
},
|
| 176 |
+
{
|
| 177 |
+
"cell_type": "code",
|
| 178 |
+
"execution_count": null,
|
| 179 |
+
"metadata": {},
|
| 180 |
+
"outputs": [],
|
| 181 |
+
"source": [
|
| 182 |
+
"# Create the Kaggle dataset, or create a new version if it already exists.\n",
|
| 183 |
+
"!KAGGLE_CONFIG_DIR=$HOME/.kaggle .venv/bin/kaggle datasets create -p kaggle_upload --dir-mode skip || \\\n",
|
| 184 |
+
" KAGGLE_CONFIG_DIR=$HOME/.kaggle .venv/bin/kaggle datasets version -p kaggle_upload --dir-mode skip -m \"Update Qwen3 Coder CodeFlow Q3_K_XL GGUF\""
|
| 185 |
+
]
|
| 186 |
+
}
|
| 187 |
+
],
|
| 188 |
+
"metadata": {
|
| 189 |
+
"accelerator": "GPU",
|
| 190 |
+
"colab": {
|
| 191 |
+
"gpuType": "A100",
|
| 192 |
+
"provenance": []
|
| 193 |
+
},
|
| 194 |
+
"kernelspec": {
|
| 195 |
+
"display_name": "Python 3",
|
| 196 |
+
"language": "python",
|
| 197 |
+
"name": "python3"
|
| 198 |
+
},
|
| 199 |
+
"language_info": {
|
| 200 |
+
"name": "python"
|
| 201 |
+
}
|
| 202 |
+
},
|
| 203 |
+
"nbformat": 4,
|
| 204 |
+
"nbformat_minor": 0
|
| 205 |
+
}
|