Instructions to use Bopalv/Qwen3-0.6B-quantized with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use Bopalv/Qwen3-0.6B-quantized with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="Bopalv/Qwen3-0.6B-quantized", filename="Qwen3-0.6B-GGUF/Qwen3-0.6B.Q4_K_M.gguf", )
llm.create_chat_completion( messages = "No input example has been defined for this model task." )
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use Bopalv/Qwen3-0.6B-quantized with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf Bopalv/Qwen3-0.6B-quantized:Q4_K_M # Run inference directly in the terminal: llama-cli -hf Bopalv/Qwen3-0.6B-quantized:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf Bopalv/Qwen3-0.6B-quantized:Q4_K_M # Run inference directly in the terminal: llama-cli -hf Bopalv/Qwen3-0.6B-quantized: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 Bopalv/Qwen3-0.6B-quantized:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf Bopalv/Qwen3-0.6B-quantized: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 Bopalv/Qwen3-0.6B-quantized:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf Bopalv/Qwen3-0.6B-quantized:Q4_K_M
Use Docker
docker model run hf.co/Bopalv/Qwen3-0.6B-quantized:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use Bopalv/Qwen3-0.6B-quantized with Ollama:
ollama run hf.co/Bopalv/Qwen3-0.6B-quantized:Q4_K_M
- Unsloth Studio
How to use Bopalv/Qwen3-0.6B-quantized 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 Bopalv/Qwen3-0.6B-quantized 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 Bopalv/Qwen3-0.6B-quantized to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Bopalv/Qwen3-0.6B-quantized to start chatting
- Pi
How to use Bopalv/Qwen3-0.6B-quantized with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf Bopalv/Qwen3-0.6B-quantized:Q4_K_M
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": "Bopalv/Qwen3-0.6B-quantized:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use Bopalv/Qwen3-0.6B-quantized with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf Bopalv/Qwen3-0.6B-quantized:Q4_K_M
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 Bopalv/Qwen3-0.6B-quantized:Q4_K_M
Run Hermes
hermes
- Docker Model Runner
How to use Bopalv/Qwen3-0.6B-quantized with Docker Model Runner:
docker model run hf.co/Bopalv/Qwen3-0.6B-quantized:Q4_K_M
- Lemonade
How to use Bopalv/Qwen3-0.6B-quantized with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Bopalv/Qwen3-0.6B-quantized:Q4_K_M
Run and chat with the model
lemonade run user.Qwen3-0.6B-quantized-Q4_K_M
List all available models
lemonade list
Upload DPO-Training/quantize_dpo_model.py with huggingface_hub
Browse files
DPO-Training/quantize_dpo_model.py
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
Quantize DPO-trained Qwen3-0.6B model to GGUF format.
|
| 4 |
+
|
| 5 |
+
Usage:
|
| 6 |
+
python quantize_dpo_model.py --model_path ./qwen3-0.6b-dpo-merged
|
| 7 |
+
python quantize_dpo_model.py --model_path ./qwen3-0.6b-dpo-merged --quantization Q4_K_M
|
| 8 |
+
"""
|
| 9 |
+
|
| 10 |
+
import argparse
|
| 11 |
+
import subprocess
|
| 12 |
+
import os
|
| 13 |
+
import sys
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
def main():
|
| 17 |
+
parser = argparse.ArgumentParser(description="Quantize DPO model to GGUF")
|
| 18 |
+
parser.add_argument("--model_path", required=True, help="Path to merged DPO model")
|
| 19 |
+
parser.add_argument(
|
| 20 |
+
"--output_name",
|
| 21 |
+
default=None,
|
| 22 |
+
help="Output GGUF file name (auto-generated if not set)",
|
| 23 |
+
)
|
| 24 |
+
parser.add_argument(
|
| 25 |
+
"--quantization",
|
| 26 |
+
default="Q4_K_S",
|
| 27 |
+
choices=[
|
| 28 |
+
"Q2_K",
|
| 29 |
+
"Q3_K_S",
|
| 30 |
+
"Q3_K_M",
|
| 31 |
+
"Q3_K_L",
|
| 32 |
+
"Q4_K_S",
|
| 33 |
+
"Q4_K_M",
|
| 34 |
+
"Q5_K_S",
|
| 35 |
+
"Q5_K_M",
|
| 36 |
+
"Q6_K",
|
| 37 |
+
"Q8_0",
|
| 38 |
+
],
|
| 39 |
+
help="Quantization type",
|
| 40 |
+
)
|
| 41 |
+
parser.add_argument(
|
| 42 |
+
"--convert_script",
|
| 43 |
+
default="/home/ma/prima.cpp/convert_hf_to_gguf.py",
|
| 44 |
+
help="Path to llama.cpp conversion script",
|
| 45 |
+
)
|
| 46 |
+
|
| 47 |
+
args = parser.parse_args()
|
| 48 |
+
|
| 49 |
+
# Generate output name if not provided
|
| 50 |
+
if args.output_name is None:
|
| 51 |
+
model_name = os.path.basename(args.model_path.rstrip("/"))
|
| 52 |
+
args.output_name = f"{model_name}-{args.quantization}.gguf"
|
| 53 |
+
|
| 54 |
+
print("=" * 60)
|
| 55 |
+
print("DPO Model Quantization")
|
| 56 |
+
print("=" * 60)
|
| 57 |
+
print(f"Model: {args.model_path}")
|
| 58 |
+
print(f"Quantization: {args.quantization}")
|
| 59 |
+
print(f"Output: {args.output_name}")
|
| 60 |
+
print("=" * 60)
|
| 61 |
+
|
| 62 |
+
# Check if model path exists
|
| 63 |
+
if not os.path.exists(args.model_path):
|
| 64 |
+
print(f"❌ Error: Model path not found: {args.model_path}")
|
| 65 |
+
sys.exit(1)
|
| 66 |
+
|
| 67 |
+
# Step 1: Convert to GGUF (FP16)
|
| 68 |
+
print("\n📥 Converting to GGUF format...")
|
| 69 |
+
temp_gguf = f"{args.output_name}.temp"
|
| 70 |
+
|
| 71 |
+
convert_cmd = [
|
| 72 |
+
sys.executable,
|
| 73 |
+
args.convert_script,
|
| 74 |
+
args.model_path,
|
| 75 |
+
"--outfile",
|
| 76 |
+
temp_gguf,
|
| 77 |
+
"--outtype",
|
| 78 |
+
"f16",
|
| 79 |
+
]
|
| 80 |
+
|
| 81 |
+
print(f"Running: {' '.join(convert_cmd)}")
|
| 82 |
+
result = subprocess.run(convert_cmd, capture_output=True, text=True)
|
| 83 |
+
|
| 84 |
+
if result.returncode != 0:
|
| 85 |
+
print(f"❌ Conversion failed: {result.stderr}")
|
| 86 |
+
sys.exit(1)
|
| 87 |
+
|
| 88 |
+
print("✅ Conversion complete")
|
| 89 |
+
|
| 90 |
+
# Step 2: Quantize
|
| 91 |
+
print(f"\n🔧 Quantizing to {args.quantization}...")
|
| 92 |
+
|
| 93 |
+
quantize_cmd = [
|
| 94 |
+
"/home/ma/prima.cpp/llama-quantize",
|
| 95 |
+
temp_gguf,
|
| 96 |
+
args.output_name,
|
| 97 |
+
args.quantization,
|
| 98 |
+
]
|
| 99 |
+
|
| 100 |
+
print(f"Running: {' '.join(quantize_cmd)}")
|
| 101 |
+
result = subprocess.run(quantize_cmd, capture_output=True, text=True)
|
| 102 |
+
|
| 103 |
+
if result.returncode != 0:
|
| 104 |
+
print(f"❌ Quantization failed: {result.stderr}")
|
| 105 |
+
sys.exit(1)
|
| 106 |
+
|
| 107 |
+
print("✅ Quantization complete")
|
| 108 |
+
|
| 109 |
+
# Clean up temp file
|
| 110 |
+
if os.path.exists(temp_gguf):
|
| 111 |
+
os.remove(temp_gguf)
|
| 112 |
+
print("🧹 Cleaned up temporary files")
|
| 113 |
+
|
| 114 |
+
# Get file size
|
| 115 |
+
if os.path.exists(args.output_name):
|
| 116 |
+
size_mb = os.path.getsize(args.output_name) / (1024 * 1024)
|
| 117 |
+
print(f"\n📦 Output file: {args.output_name} ({size_mb:.1f} MB)")
|
| 118 |
+
|
| 119 |
+
print("\n" + "=" * 60)
|
| 120 |
+
print("✅ Quantization Complete!")
|
| 121 |
+
print("=" * 60)
|
| 122 |
+
print(f"Quantized model: {args.output_name}")
|
| 123 |
+
print(f"Ready for deployment!")
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
if __name__ == "__main__":
|
| 127 |
+
main()
|