欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 文旅 > 八卦 > TensorRT-LLM笔记

TensorRT-LLM笔记

2025/9/15 18:27:08 来源:https://blog.csdn.net/smartcat2010/article/details/143462895  浏览:    关键词:TensorRT-LLM笔记

原文链接

开启inflight-batching, client侧需要使用inflight_batcher_llm_client.py:

python3 inflight_batcher_llm/client/inflight_batcher_llm_client.py --request-output-len 200 --tokenizer-dir ${HF_LLAMA_MODEL}

bad_words: output中不允许出现的词语;

stop_words: output生成到这些词,则停止;

build engine常用参数:

--gpt_attention_plugin float16

--gemm_plugin float16

--context_fmha enable

--kv_cache_type paged:Paged KV Cache?

Best Practices for Tuning the Performance of TensorRT-LLM — tensorrt_llm documentation

max_batch_sizemax_seq_len and max_num_tokens

--multiple_profiles: 允许trtllm多次尝试,其自动选取性能最好的;

1. 默认打开:--gpt_attention_plugin:in-place update on KV cache;减少了显存占用,减少了显存copy;

2. 默认打开:--context_fmha:attention计算这里,是否采用fused kernel;短句子,用vanilla;长句子,用FlashAttention和FlashAttention2; 官网介绍

3. 默认打开:--remove_input_padding:输入序列末尾不再padding;(我猜就是为inflight-batching?)

4. 默认打开:--paged_kv_cache:Paged Attention;

5. 默认打开: inflight-batching; 当1、3、4都打开时,该功能自动打开;将context阶段的seq和generate阶段的seq,放在同一个batch里,interleave起来进行计算?

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词