模型简介
模型特点
模型能力
使用案例
🚀 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)



