chore: bootstrap reusable quantization template workspace

This commit is contained in:
2026-03-02 23:07:48 +08:00
commit 1c5822d16b
15 changed files with 167197 additions and 0 deletions

5
modelscope_upload/.gitattributes vendored Normal file
View File

@@ -0,0 +1,5 @@
*.gguf filter=lfs diff=lfs merge=lfs -text
*.dat filter=lfs diff=lfs merge=lfs -text
*.md text eol=lf
*.json text eol=lf
.gitattributes text eol=lf

Binary file not shown.

View File

@@ -0,0 +1,76 @@
---
tags:
- text-generation
- qwen
- qwen35
- gguf
- quantization
tasks:
- text-generation
license: Apache License 2.0
---
# Qwen3.5-27B Quantized GGUF (IQ4_KS / IQ5_K / IQ6_K)
## 模型说明
该仓库提供 Qwen3.5-27B 的 GGUF 量化版本,适配 llama.cpp 生态,包含 IQ4_KS、IQ5_K、IQ6_K 三种规格。权重由 BF16 GGUF 输入文件通过 imatrix 方式量化,重点平衡了体积、推理速度与精度表现,适用于不同显存预算下的文本生成任务。
## 权重来源
- 原始 BF16 GGUF 来源:`TeichAI/Qwen3.5-27B-Claude-Opus-4.6-Distill-GGUF`
- 本仓库内容为基于该来源进行 imatrix + GGUF 量化后的发布版本IQ4_KS / IQ5_K / IQ6_K
## 量化方法
本仓库采用 `ik_llama.cpp` Docker 镜像(`hotwa/ik:latest`)进行两阶段量化:
1. 先用 `llama-imatrix` 基于校准语料计算 importance matrix`Qwen3.5-27B.imatrix.dat`
2. 再用 `llama-quantize --imatrix ...` 分别导出 `IQ4_KS``IQ5_K``IQ6_K`
核心量化参数:
- imatrix 输入模型:`Qwen3.5-27b-Opus-4.6-Distill-BF16-00001-of-00002.gguf`
- `--ctx-size 512`
- `-ngl 99`
- `--threads 16`
该流程使用 imatrix 对不同权重的重要性进行建模,可在同等量化位宽下减少关键层信息损失,提升量化后推理稳定性。
## 校准数据来源与选择依据
量化校准文件为 `calibration_data_v5_rc_code.txt`,总计 `4152` blocks构成如下
- `1152` blocks基础校准数据 `calibration_data_v5_rc.txt`
- `2000` blocks`QuixiAI/Code-74k-ShareGPT-Vicuna`
- `1000` blocks`alvarobartt/openhermes-preferences-coding``chosen` 分支)
基础校准数据下载源:
- 社区常用版本:`https://gist.githubusercontent.com/tristandruyen/9e207a95c7d75ddf37525d353e00659c/raw/571fda718462de863e5a0171078c175420c7649a/calibration_data_v5_rc.txt`
- 官方备用源:`https://raw.githubusercontent.com/ggerganov/llama.cpp/master/examples/calibration/calibration_data.txt`
选择这三部分数据的目的:
- 基础数据用于覆盖通用语义与常见文本分布,避免模型只对代码域过拟合
- Code-74k 对话样本提升代码生成、调试、解释等场景的量化保真度
- OpenHermes coding preference 样本提供“更优回答偏好”信号,帮助保持代码输出的结构化与可读性
该组合在“通用文本 + 代码任务”之间做了平衡,适合 Qwen3.5-27B Distill 模型的实际使用场景。
## 文件内容
- `Qwen3.5-27B-IQ4_KS.gguf`:低显存优先
- `Qwen3.5-27B-IQ5_K.gguf`:性能和质量平衡
- `Qwen3.5-27B-IQ6_K.gguf`:更高保真优先
- `Qwen3.5-27B.imatrix.dat`:量化使用的 importance matrix
## 使用建议
- 设备资源紧张时优先 IQ4_KS
- 通用推理场景优先 IQ5_K
- 对质量要求更高时使用 IQ6_K
## 备注
该仓库用于发布可直接推理的 GGUF 权重,不包含训练过程文件。推理时请使用支持 GGUF 的推理框架(如 llama.cpp 相关实现)。

View File

@@ -0,0 +1,10 @@
{
"framework": "ggml",
"task": "text-generation",
"model": {
"type": "qwen35"
},
"pipeline": {
"type": "text-generation"
}
}