模型概述
模型特點
模型能力
使用案例
🚀 Menlo的Jan - nano量化模型
本項目基於llama.cpp
對Menlo/Jan - nano
模型進行量化處理,提供多種量化類型的模型文件,以滿足不同硬件和性能需求。用戶可根據自身硬件配置和使用場景選擇合適的量化模型文件進行下載和使用。
🚀 快速開始
本項目是對Menlo/Jan - nano
模型的量化版本。使用 llama.cpp 的 b5627 版本進行量化。
- 原始模型地址:[https://huggingface.co/Menlo/Jan - nano](https://huggingface.co/Menlo/Jan - nano)
- 所有量化模型均使用
imatrix
選項,並採用 此處 的數據集。 - 可在 LM Studio 中運行這些量化模型。
- 也可直接使用 llama.cpp 或其他基於
llama.cpp
的項目來運行。
✨ 主要特性
- 多種量化類型:提供瞭如
bf16
、Q8_0
、Q6_K_L
等多種量化類型的模型文件,用戶可根據自身硬件和性能需求進行選擇。 - 優化權重處理:部分量化模型(如
Q3_K_XL
、Q4_K_L
等)採用了將嵌入和輸出權重量化為Q8_0
的標準量化方法,以提高性能。 - 在線重打包功能:對於部分量化模型(如
Q4_0
),支持在線重打包權重,以提高在ARM
和AVX
機器上的性能。
📦 安裝指南
使用huggingface - cli
下載
首先,確保你已經安裝了huggingface - cli
:
pip install -U "huggingface_hub[cli]"
然後,你可以指定要下載的特定文件:
huggingface-cli download bartowski/Menlo_Jan-nano-GGUF --include "Menlo_Jan-nano-Q4_K_M.gguf" --local-dir ./
如果模型文件大於 50GB,它會被分割成多個文件。若要將它們全部下載到本地文件夾,請運行:
huggingface-cli download bartowski/Menlo_Jan-nano-GGUF --include "Menlo_Jan-nano-Q8_0/*" --local-dir ./
你可以指定一個新的本地目錄(如Menlo_Jan - nano - Q8_0
),也可以將它們全部下載到當前目錄(./
)。
💻 使用示例
提示格式
<|im_start|>system
{system_prompt}<|im_end|>
<|im_start|>user
{prompt}<|im_end|>
<|im_start|>assistant
<think>
</think>
📚 詳細文檔
下載文件選擇
文件名 | 量化類型 | 文件大小 | 分割情況 | 描述 |
---|---|---|---|---|
[Jan - nano - bf16.gguf](https://huggingface.co/bartowski/Menlo_Jan - nano - GGUF/blob/main/Menlo_Jan - nano - bf16.gguf) | bf16 | 8.05GB | false | 完整的BF16 權重。 |
[Jan - nano - Q8_0.gguf](https://huggingface.co/bartowski/Menlo_Jan - nano - GGUF/blob/main/Menlo_Jan - nano - Q8_0.gguf) | Q8_0 | 4.28GB | false | 極高質量,通常不需要,但為最大可用量化。 |
[Jan - nano - Q6_K_L.gguf](https://huggingface.co/bartowski/Menlo_Jan - nano - GGUF/blob/main/Menlo_Jan - nano - Q6_K_L.gguf) | Q6_K_L | 3.40GB | false | 嵌入和輸出權重使用Q8_0 ,非常高質量,接近完美,推薦。 |
[Jan - nano - Q6_K.gguf](https://huggingface.co/bartowski/Menlo_Jan - nano - GGUF/blob/main/Menlo_Jan - nano - Q6_K.gguf) | Q6_K | 3.31GB | false | 非常高質量,接近完美,推薦。 |
[Jan - nano - Q5_K_L.gguf](https://huggingface.co/bartowski/Menlo_Jan - nano - GGUF/blob/main/Menlo_Jan - nano - Q5_K_L.gguf) | Q5_K_L | 2.98GB | false | 嵌入和輸出權重使用Q8_0 ,高質量,推薦。 |
[Jan - nano - Q5_K_M.gguf](https://huggingface.co/bartowski/Menlo_Jan - nano - GGUF/blob/main/Menlo_Jan - nano - Q5_K_M.gguf) | Q5_K_M | 2.89GB | false | 高質量,推薦。 |
[Jan - nano - Q5_K_S.gguf](https://huggingface.co/bartowski/Menlo_Jan - nano - GGUF/blob/main/Menlo_Jan - nano - Q5_K_S.gguf) | Q5_K_S | 2.82GB | false | 高質量,推薦。 |
[Jan - nano - Q4_1.gguf](https://huggingface.co/bartowski/Menlo_Jan - nano - GGUF/blob/main/Menlo_Jan - nano - Q4_1.gguf) | Q4_1 | 2.60GB | false | 舊格式,性能與Q4_K_S 相似,但在蘋果硅芯片上的每瓦令牌數有所提高。 |
[Jan - nano - Q4_K_L.gguf](https://huggingface.co/bartowski/Menlo_Jan - nano - GGUF/blob/main/Menlo_Jan - nano - Q4_K_L.gguf) | Q4_K_L | 2.59GB | false | 嵌入和輸出權重使用Q8_0 ,質量良好,推薦。 |
[Jan - nano - Q4_K_M.gguf](https://huggingface.co/bartowski/Menlo_Jan - nano - GGUF/blob/main/Menlo_Jan - nano - Q4_K_M.gguf) | Q4_K_M | 2.50GB | false | 質量良好,大多數用例的默認大小,推薦。 |
[Jan - nano - Q4_K_S.gguf](https://huggingface.co/bartowski/Menlo_Jan - nano - GGUF/blob/main/Menlo_Jan - nano - Q4_K_S.gguf) | Q4_K_S | 2.38GB | false | 質量稍低,但節省空間,推薦。 |
[Jan - nano - Q4_0.gguf](https://huggingface.co/bartowski/Menlo_Jan - nano - GGUF/blob/main/Menlo_Jan - nano - Q4_0.gguf) | Q4_0 | 2.38GB | false | 舊格式,提供用於ARM 和AVX CPU推理的在線重新打包功能。 |
[Jan - nano - IQ4_NL.gguf](https://huggingface.co/bartowski/Menlo_Jan - nano - GGUF/blob/main/Menlo_Jan - nano - IQ4_NL.gguf) | IQ4_NL | 2.38GB | false | 與IQ4_XS 相似,但稍大,提供用於ARM CPU推理的在線重新打包功能。 |
[Jan - nano - Q3_K_XL.gguf](https://huggingface.co/bartowski/Menlo_Jan - nano - GGUF/blob/main/Menlo_Jan - nano - Q3_K_XL.gguf) | Q3_K_XL | 2.33GB | false | 嵌入和輸出權重使用Q8_0 ,質量較低但可用,適用於低內存情況。 |
[Jan - nano - IQ4_XS.gguf](https://huggingface.co/bartowski/Menlo_Jan - nano - GGUF/blob/main/Menlo_Jan - nano - IQ4_XS.gguf) | IQ4_XS | 2.27GB | false | 質量不錯,比Q4_K_S 小,性能相似,推薦。 |
[Jan - nano - Q3_K_L.gguf](https://huggingface.co/bartowski/Menlo_Jan - nano - GGUF/blob/main/Menlo_Jan - nano - Q3_K_L.gguf) | Q3_K_L | 2.24GB | false | 質量較低但可用,適用於低內存情況。 |
[Jan - nano - Q3_K_M.gguf](https://huggingface.co/bartowski/Menlo_Jan - nano - GGUF/blob/main/Menlo_Jan - nano - Q3_K_M.gguf) | Q3_K_M | 2.08GB | false | 低質量。 |
[Jan - nano - IQ3_M.gguf](https://huggingface.co/bartowski/Menlo_Jan - nano - GGUF/blob/main/Menlo_Jan - nano - IQ3_M.gguf) | IQ3_M | 1.96GB | false | 中低質量,新方法,性能與Q3_K_M 相當。 |
[Jan - nano - Q3_K_S.gguf](https://huggingface.co/bartowski/Menlo_Jan - nano - GGUF/blob/main/Menlo_Jan - nano - Q3_K_S.gguf) | Q3_K_S | 1.89GB | false | 低質量,不推薦。 |
[Jan - nano - IQ3_XS.gguf](https://huggingface.co/bartowski/Menlo_Jan - nano - GGUF/blob/main/Menlo_Jan - nano - IQ3_XS.gguf) | IQ3_XS | 1.81GB | false | 質量較低,新方法,性能不錯,略優於Q3_K_S 。 |
[Jan - nano - Q2_K_L.gguf](https://huggingface.co/bartowski/Menlo_Jan - nano - GGUF/blob/main/Menlo_Jan - nano - Q2_K_L.gguf) | Q2_K_L | 1.76GB | false | 嵌入和輸出權重使用Q8_0 ,質量非常低,但出人意料地可用。 |
[Jan - nano - IQ3_XXS.gguf](https://huggingface.co/bartowski/Menlo_Jan - nano - GGUF/blob/main/Menlo_Jan - nano - IQ3_XXS.gguf) | IQ3_XXS | 1.67GB | false | 質量較低,新方法,性能不錯,與Q3 量化相當。 |
[Jan - nano - Q2_K.gguf](https://huggingface.co/bartowski/Menlo_Jan - nano - GGUF/blob/main/Menlo_Jan - nano - Q2_K.gguf) | Q2_K | 1.67GB | false | 質量非常低,但出人意料地可用。 |
[Jan - nano - IQ2_M.gguf](https://huggingface.co/bartowski/Menlo_Jan - nano - GGUF/blob/main/Menlo_Jan - nano - IQ2_M.gguf) | IQ2_M | 1.51GB | false | 質量相對較低,使用了最先進的技術,出人意料地可用。 |
嵌入/輸出權重
部分量化模型(如Q3_K_XL
、Q4_K_L
等)採用了標準量化方法,將嵌入和輸出權重量化為Q8_0
,而非通常的默認值。
ARM/AVX信息
以前,你會下載Q4_0_4_4/4_8/8_8
,這些模型的權重會在內存中交錯排列,以便通過一次加載更多數據來提高ARM
和AVX
機器的性能。
現在,對於權重有了所謂的“在線重打包”功能,詳情見 此PR。如果你使用Q4_0
,並且你的硬件可以從權重重打包中受益,它將自動即時進行重打包。
從llama.cpp
的 b4282 版本開始,你將無法運行Q4_0_X_X
文件,而需要使用Q4_0
。
此外,如果你想獲得稍好的質量,可以使用IQ4_NL
,這得益於 此PR,它也會為ARM
重打包權重,但目前僅適用於4_4
。加載時間可能會更長,但總體速度會提高。
選擇合適的文件
點擊查看詳情
Artefact2 在 此處 提供了一份很棒的帶有圖表的文章,展示了各種性能。
首先,你需要確定你可以運行多大的模型。為此,你需要了解你有多少內存(RAM
)和/或顯存(VRAM
)。
如果你希望模型運行得儘可能快,你需要將整個模型放入 GPU 的顯存中。目標是選擇一個文件大小比你的 GPU 總顯存小 1 - 2GB 的量化模型。
如果你想要絕對最高的質量,將你的系統內存和 GPU 的顯存相加,然後同樣選擇一個文件大小比該總和小 1 - 2GB 的量化模型。
接下來,你需要決定是使用“I - 量化”還是“K - 量化”。
如果你不想考慮太多,選擇一個K - 量化
模型。這些模型的格式為QX_K_X
,如Q5_K_M
。
如果你想深入瞭解,可以查看這個非常有用的特性圖表:
[llama.cpp 特性矩陣](https://github.com/ggerganov/llama.cpp/wiki/Feature - matrix)
但基本上,如果你目標是低於Q4
的量化,並且你使用的是cuBLAS
(英偉達)或rocBLAS
(AMD),你應該考慮I - 量化
模型。這些模型的格式為IQX_X
,如IQ3_M
。這些是較新的模型,對於相同大小的模型,它們提供更好的性能。
這些I - 量化
模型也可以在 CPU 上使用,但會比相應的K - 量化
模型慢,因此你需要在速度和性能之間進行權衡。
🔧 技術細節
基準測試(AVX2系統 - EPYC7702)
點擊查看基準測試
模型 | 大小 | 參數 | 後端 | 線程數 | 測試類型 | 每秒令牌數 | 與Q4_0對比 |
---|---|---|---|---|---|---|---|
qwen2 3B Q4_0 | 1.70 GiB | 3.09 B | CPU | 64 | pp512 | 204.03 ± 1.03 | 100% |
qwen2 3B Q4_0 | 1.70 GiB | 3.09 B | CPU | 64 | pp1024 | 282.92 ± 0.19 | 100% |
qwen2 3B Q4_0 | 1.70 GiB | 3.09 B | CPU | 64 | pp2048 | 259.49 ± 0.44 | 100% |
qwen2 3B Q4_0 | 1.70 GiB | 3.09 B | CPU | 64 | tg128 | 39.12 ± 0.27 | 100% |
qwen2 3B Q4_0 | 1.70 GiB | 3.09 B | CPU | 64 | tg256 | 39.31 ± 0.69 | 100% |
qwen2 3B Q4_0 | 1.70 GiB | 3.09 B | CPU | 64 | tg512 | 40.52 ± 0.03 | 100% |
qwen2 3B Q4_K_M | 1.79 GiB | 3.09 B | CPU | 64 | pp512 | 301.02 ± 1.74 | 147% |
qwen2 3B Q4_K_M | 1.79 GiB | 3.09 B | CPU | 64 | pp1024 | 287.23 ± 0.20 | 101% |
qwen2 3B Q4_K_M | 1.79 GiB | 3.09 B | CPU | 64 | pp2048 | 262.77 ± 1.81 | 101% |
qwen2 3B Q4_K_M | 1.79 GiB | 3.09 B | CPU | 64 | tg128 | 18.80 ± 0.99 | 48% |
qwen2 3B Q4_K_M | 1.79 GiB | 3.09 B | CPU | 64 | tg256 | 24.46 ± 3.04 | 83% |
qwen2 3B Q4_K_M | 1.79 GiB | 3.09 B | CPU | 64 | tg512 | 36.32 ± 3.59 | 90% |
qwen2 3B Q4_0_8_8 | 1.69 GiB | 3.09 B | CPU | 64 | pp512 | 271.71 ± 3.53 | 133% |
qwen2 3B Q4_0_8_8 | 1.69 GiB | 3.09 B | CPU | 64 | pp1024 | 279.86 ± 45.63 | 100% |
qwen2 3B Q4_0_8_8 | 1.69 GiB | 3.09 B | CPU | 64 | pp2048 | 320.77 ± 5.00 | 124% |
qwen2 3B Q4_0_8_8 | 1.69 GiB | 3.09 B | CPU | 64 | tg128 | 43.51 ± 0.05 | 111% |
qwen2 3B Q4_0_8_8 | 1.69 GiB | 3.09 B | CPU | 64 | tg256 | 43.35 ± 0.09 | 110% |
qwen2 3B Q4_0_8_8 | 1.69 GiB | 3.09 B | CPU | 64 | tg512 | 42.60 ± 0.31 | 105% |
Q4_0_8_8
在提示處理方面有顯著提升,在文本生成方面有小幅提升。
📄 許可證
本項目採用Apache - 2.0
許可證。
致謝
感謝 kalomaze 和 Dampf 在創建imatrix
校準數據集方面提供的幫助。
感謝 ZeroWw 在嵌入/輸出實驗方面提供的靈感。
感謝 LM Studio 對本項目的贊助。
如果你想支持我的工作,請訪問我的 ko - fi 頁面:[https://ko - fi.com/bartowski](https://ko - fi.com/bartowski)



