高通 Gen AI 推理扩展 (GENIE)(8):qnn-genai-transformer-composer
·
该 qnn-genai-transformer-composer 工具准备一个模型,用于通过 Genie 进行推理,但专门针对 Gen AI Transformer 后端。
GenAITransformer Composer 工具
DESCRIPTION:
------------
Tool to convert a supported LLM model to a binary file consumable by Genie execution engine.
REQUIRED ARGUMENTS:
-------------------
--model <DIR> Path to the downloaded LLM model directory.
OPTIONAL ARGUMENTS:
-------------------
-h, --help Show this help message and exit.
--config_file <DIR> Path to the generic configuration.json
--quantize {Z4,Z4_FP16,Z8,Q4} <VAL> Quantization type. If not specified, output format will be FP32.
Q4 uses a block of 32 elements. It provides the highest accuracy,
yet with lowest performance. Z4 and Z8 uses block of 128 elements.
The accuracy is sufficient for most models, with Z8 giving highest
performance.
--outfile OUTFILE <FILE> Path to write to; default: path provided in --model parameter.
--lora <DIR> Path to the lora adapter model directory, if specified then --quantize
option should not be specified.
--lm_head_precision <VAL> Precision for lm_head (output.weight) tensor. "FP_32" supported.
--export_tokenizer_json Exports the tokenizer model to HuggingFace Fast Tokenizer .json file.
The tokenizer.json file will be written to the path specified via the
--outfile parameter.
--dump_lut Dumps the token embedding weight as LUT.bin in the path specified via
the --outfile parameter.
注意
–export_tokenizer_json 选项支持 QWen-1、BaiChuan-1、Mistral、wt19-en-de 和 mx-translation 模型的分词器。如果未提供 --config_file 选项,则编辑器将访问 --model 选项中给出的下载模型路径中的 config.json 文件,并相应地从 QNN_SDK_ROOT 路径获取通用配置文件。
通用配置文件说明
Configuration.json 将是一个 JSON 文件,该文件将向 提供 qnn-genai-transformer-composer 有关模型的信息,以准备模型以通过 Genie 进行推理。
模型参数说明
该模型有 26 个静态参数,在 5 类参数下:
- 常规参数提供有关模型的全局信息。
- 尺寸参数告知主要模型尺寸。
- 体系结构参数提供有关变压器控制流的信息。
- 作参数传达操作员详细信息。
- 张量参数提供有关模型张量的详细信息
模型张量说明
张量规范化名称的形式为 tensor.identifier_weight 和 tensor.identifier_bias 其中“标识符”是以下之一:
RoPE 缩放配置说明
Model params 表中的 operation.rope.scaling.config 键是一个字典,其中包含取决于 RoPE 类型的键。以下部分介绍不同绳索类型的键。
Rope Type llama3
Rope Type yarn
Rope Type longrope
更多推荐
所有评论(0)