Transformers documentation
TensorRT-LLM
はじめに
ベースクラス
モデル
プリプロセッサ
推論
Pipeline API
Generate API
最適化
モデルとチャットする
サービング
トレーニング
ハードウェア
量子化
エコシステム統合
リソース
API
You are viewing main version, which requires installation from source. If you'd like
regular pip install, checkout the latest stable version (v5.22.1).
TensorRT-LLM
TensorRT-LLMはNVIDIA GPU上のLLM推論を最適化します。モデルをTensorRTエンジンにコンパイルし、in-flight batching、paged KVキャッシュ、テンソル並列処理を実現します。AutoDeployは、変更を加えることなくTransformersモデルを受け入れます。モデルを最適化されたランタイムへ自動的に変換します。
Hub のモデル ID を build_and_run_ad.py に渡すことで、Transformers モデルを実行できます。
cd examples/auto_deploy
python build_and_run_ad.py --model meta-llama/Llama-3.2-1BUnder the hood, AutoDeploy creates an LLM class. It loads the model configuration with AutoConfig.from_pretrained() and extracts any parallelism metadata stored in tp_plan. AutoModelForCausalLM.from_pretrained() loads the model with the config and enables Transformers’ built-in tensor parallelism.
from tensorrt_llm._torch.auto_deploy import LLM
llm = LLM(model="meta-llama/Llama-3.2-1B")TensorRT-LLM は torch.export でモデルグラフを抽出し、最適化を適用します。Transformers のアテンションを TensorRT-LLM の アテンションカーネル に置き換え、モデルを最適化された実行バックエンドにコンパイルします。
リソース
- より詳細な使用ガイドについては、TensorRT-LLM ドキュメントを参照してください。
- AutoDeploy ガイドでは、高度な例を用いてその仕組みを説明しています。