# Workflow Template 本流程用于新模型接入,默认在仓库根目录执行。 ## Step 1: HF -> BF16 GGUF 使用 `ik_llama.cpp` 的转换脚本: ```bash python convert_hf_to_gguf.py \ \ --outtype bf16 \ --outfile artifacts//base_gguf/-bf16.gguf ``` ## Step 2: 准备校准数据 ```bash ./.venv/bin/python scripts/prepare_calib_data.py --force-refresh ``` 输出: - `calibration/calibration_data_v5_rc.txt` - `calibration/calibration_data_v5_rc_code.txt` 固定组成:1152 + 2000 + 1000 = 4152 blocks。 ## Step 3: 生成 imatrix ```bash docker run --gpus all --rm \ --entrypoint sh \ -v :/workspace/models \ -v /calibration/calibration_data_v5_rc_code.txt:/workspace/calib_data.txt \ hotwa/ik:latest \ -c "/llama-imatrix -m -f /workspace/calib_data.txt -o --ctx-size 512 -ngl 99 --threads 16" ``` ## Step 4: 量化导出 分别执行: ```bash docker run --gpus all --rm \ --entrypoint sh \ -v :/workspace/models \ hotwa/ik:latest \ -c "/llama-quantize --imatrix IQ4_KS" ``` 将量化结果放入:`artifacts//quantized_gguf/`。 ## Step 5: 组织上传目录 ```bash cp templates/modelscope/README.template.md modelscope_upload/README.md cp templates/modelscope/configuration.template.json modelscope_upload/configuration.json cp templates/modelscope/.gitattributes modelscope_upload/.gitattributes ``` 然后把目标发布文件复制到 `modelscope_upload/`。 ## Step 6: 上传 ```bash ./scripts/upload_to_modelscope.sh modelscope_upload direct "Upload quantized GGUF" ``` - `direct`:关闭代理上传 - `proxy`:保留代理上传