Views
No views yet
1# 下載模型文件
2huggingface-cli download vito95311/Qwen3-Omni-30B-A3B-Thinking-GGUF-INT8FP16 qwen3_omni_quantized.gguf --local-dir ./
3huggingface-cli download vito95311/Qwen3-Omni-30B-A3B-Thinking-GGUF-INT8FP16 Qwen3OmniQuantized.modelfile --local-dir ./
4
5# 創建Ollama模型
6ollama create qwen3-omni-quantized -f Qwen3OmniQuantized.modelfile
7
8# 開始對話
9ollama run qwen3-omni-quantized1# 或直接使用ollama pull指令下載並創建
2ollama pull hf.co/vito95311/Qwen3-Omni-30B-A3B-Thinking-GGUF-INT8FP161# 編譯llama.cpp(如果尚未安裝)
2git clone https://github.com/ggerganov/llama.cpp
3cd llama.cpp && make -j8
4
5# 下載GGUF模型
6huggingface-cli download vito95311/Qwen3-Omni-30B-A3B-Thinking-GGUF-INT8FP16 qwen3_omni_quantized.gguf --local-dir ./
7
8# 運行推理
9./main -m qwen3_omni_quantized.gguf -p "你好,請介紹一下你自己" -n 2561# 使用llama-cpp-python
2pip install llama-cpp-python
3
4from llama_cpp import Llama
5
6# 載入GGUF模型
7llm = Llama(
8 model_path="qwen3_omni_quantized.gguf",
9 n_gpu_layers=35, # GPU加速層數
10 n_ctx=4096, # 上下文長度
11 verbose=False
12)
13
14# 生成回應
15response = llm(
16 "請用一句話解釋量子計算",
17 max_tokens=128,
18 temperature=0.7,
19 top_p=0.8
20)
21
22print(response['choices'][0]['text'])1# GPU 推理(推薦)
2GPU: RTX 4090 (24GB) / RTX 5090 (32GB)
3RAM: 16GB+ DDR4/DDR5
4VRAM: 20GB+ 用於GPU層offloading
5
6# CPU 推理(備選)
7CPU: 16核心+ (Intel i7/AMD Ryzen 7+)
8RAM: 64GB+ DDR4/DDR51# Ollama 環境變數設定
2export OLLAMA_NUM_PARALLEL=4 # 並行請求數
3export OLLAMA_MAX_LOADED_MODELS=2 # 最大載入模型數
4export OLLAMA_FLASH_ATTENTION=1 # 啟用Flash Attention
5export OLLAMA_GPU_MEMORY_FRACTION=0.9 # GPU記憶體使用比例
6
7# llama.cpp 最佳化參數
8./main -m model.gguf \
9 --n-gpu-layers 35 \ # GPU加速層數
10 --batch-size 512 \ # 批次大小
11 --threads 8 \ # CPU線程數
12 --mlock # 鎖定記憶體防止swap| 量化格式 | 文件大小 | 記憶體使用 | 推理速度 | 精度保持 | 推薦用途 |
|---|---|---|---|---|---|
| Q8_0 (推薦) | 31GB | 28GB | 25+ tokens/秒 | 95%+ | 平衡性能 |
| F16 | 31GB | 32GB | 30+ tokens/秒 | 99% | 高精度需求 |
| Q4_0 | 18GB | 20GB | 35+ tokens/秒 | 85% | 資源受限 |
| Q2_K | 12GB | 14GB | 40+ tokens/秒 | 75% | 極限壓縮 |
| 硬體配置 | Ollama速度 | llama.cpp速度 | GPU記憶體 | 載入時間 |
|---|---|---|---|---|
| RTX 5090 32GB | 28-32 tokens/秒 | 30-35 tokens/秒 | 26GB | 8秒 |
| RTX 4090 24GB | 22-26 tokens/秒 | 25-30 tokens/秒 | 22GB | 12秒 |
| RTX 4080 16GB | 15-20 tokens/秒 | 18-22 tokens/秒 | 15GB | 18秒 |
| CPU Only | 3-5 tokens/秒 | 4-6 tokens/秒 | 32GB RAM | 15秒 |
1# GGUF版本支援的能力
2capabilities = {
3 "text_generation": "✅ 優秀 (95%+ 原版質量)",
4 "multilingual": "✅ 完整支援中英文+100種語言",
5 "code_generation": "✅ Python/JS/Go等多語言代碼",
6 "reasoning": "✅ 邏輯推理和數學問題",
7 "creative_writing": "✅ 創意寫作和故事生成",
8 "image_understanding": "⚠️ 需要multimodal版本llama.cpp",
9 "audio_processing": "⚠️ 需要額外音頻處理工具"
10}1# 自定義 Modelfile
2FROM /path/to/qwen3_omni_quantized.gguf
3
4# 調整生成參數
5PARAMETER temperature 0.8 # 創意度
6PARAMETER top_p 0.9 # nucleus採樣
7PARAMETER top_k 50 # top-k採樣
8PARAMETER repeat_penalty 1.1 # 重複懲罰
9PARAMETER num_predict 512 # 最大生成長度
10
11# 自定義系統提示
12SYSTEM """你是一個專業的AI助手,擅長技術問題解答和創意寫作。請用專業且友善的語氣回應用戶。"""
13
14# 自定義對話模板
15TEMPLATE """[INST] {{ .Prompt }} [/INST] {{ .Response }}"""1# text-generation-webui 支援
2git clone https://github.com/oobabooga/text-generation-webui
3cd text-generation-webui
4
5# 安裝GGUF支援
6pip install llama-cpp-python
7
8# 將GGUF文件放入models目錄並啟動
9python server.py --model qwen3_omni_quantized.gguf --loader llama.cpp1# 檢查模型完整性
2ollama list
3ollama show qwen3-omni-quantized
4
5# 重新創建模型
6ollama rm qwen3-omni-quantized
7ollama create qwen3-omni-quantized -f Qwen3OmniQuantized.modelfile1# 減少GPU層數
2./main -m model.gguf --n-gpu-layers 20 # 降低到20層
3
4# 使用記憶體映射
5./main -m model.gguf --mmap --mlock
6
7# 調整批次大小
8./main -m model.gguf --batch-size 2561# 調整採樣參數
2./main -m model.gguf \
3 --temp 0.7 \ # 降低溫度提高一致性
4 --top-p 0.8 \ # 調整nucleus採樣
5 --repeat-penalty 1.1 # 減少重複qwen3-omni-gguf/
├── 🧠 GGUF模型文件
│ ├── qwen3_omni_quantized.gguf # INT8量化版本 (推薦)
│ └── qwen3_omni_f16.gguf # FP16精度版本
│
├── 🔧 配置文件
│ ├── Qwen3OmniQuantized.modelfile # Ollama配置
│ ├── config.json # 模型配置信息
│ └── tokenizer.json # 分詞器配置
│
└── 📚 文檔
├── README.md # 使用說明
├── GGUF_GUIDE.md # GGUF格式詳解
└── OLLAMA_DEPLOYMENT.md # Ollama部署指南ollama run hf.co/vito95311/Qwen3-Omni-30B-A3B-Thinking-GGUF-INT8FP16