| # ============================================================================ | |
| # Ollama Modelfile for GLM-5.2 (GGUF version) | |
| # ============================================================================ | |
| # PREREQUISITE: Mount the GGUF repo first: | |
| # hf-mount start --hf-token $HF_TOKEN repo unsloth/GLM-5.2-GGUF /mnt/glm52-gguf | |
| # | |
| # Then adjust the FROM path below to match the actual GGUF filename. | |
| # Available quants from unsloth/GLM-5.2-GGUF typically include: | |
| # Q2_K, Q3_K_M, Q4_K_M, Q5_K_M, Q6_K, Q8_0, F16 | |
| # | |
| # Choose based on your available RAM/VRAM: | |
| # Q4_K_M ≈ good balance of quality and size | |
| # Q2_K ≈ smallest, lower quality | |
| # Q8_0 ≈ near-lossless, largest | |
| # ============================================================================ | |
| FROM /mnt/glm52-gguf/GLM-5.2-Q4_K_M.gguf | |
| # --- Generation Parameters --- | |
| PARAMETER temperature 0.7 | |
| PARAMETER top_p 0.9 | |
| PARAMETER top_k 50 | |
| PARAMETER num_ctx 32768 | |
| PARAMETER repeat_penalty 1.1 | |
| PARAMETER num_predict -1 | |
| PARAMETER seed 42 | |
| # --- Stop Tokens (GLM format) --- | |
| PARAMETER stop "<|endoftext|>" | |
| PARAMETER stop "<|user|>" | |
| PARAMETER stop "<|assistant|>" | |
| PARAMETER stop "<|observation|>" | |
| # --- System Prompt --- | |
| SYSTEM """You are GLM-5.2, a large language model developed by Zhipu AI. You are helpful, harmless, and honest. Respond clearly and concisely.""" | |
| # --- Chat Template (GLM conversation format) --- | |
| TEMPLATE """{{ if .System }}<|system|> | |
| {{ .System }}<|endoftext|> | |
| {{ end }}{{ if .Prompt }}<|user|> | |
| {{ .Prompt }}<|endoftext|> | |
| {{ end }}<|assistant|> | |
| {{ .Response }}<|endoftext|> | |
| """ | |
| # --- License --- | |
| LICENSE "MIT" | |
| # ============================================================================ | |
| # BUILD COMMAND: | |
| # ollama create glm-5.2 -f Modelfile | |
| # | |
| # RUN COMMAND: | |
| # ollama run glm-5.2 | |
| # | |
| # The ollama create command will: | |
| # 1. Read the GGUF from the mounted path (lazy I/O via hf-mount) | |
| # 2. Copy the weight blob into ~/.ollama/models/blobs/ | |
| # 3. Auto-generate a manifest at: | |
| # ~/.ollama/models/manifests/registry.ollama.ai/library/glm-5.2/latest | |
| # | |
| # NOTE: `ollama create` copies the GGUF into Ollama's blob store. | |
| # This means the full GGUF file WILL be copied locally during create. | |
| # To avoid this, use vLLM instead — it reads directly from the mount. | |
| # ============================================================================ | |