Transformers documentation

TensorRT-LLM

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

TensorRT-LLM

TensorRT-LLM оптимизирует инференс LLM на GPU NVIDIA. Он компилирует модели в движок TensorRT с поддержкой in-flight batching, paged KV caching и tensor parallelism. AutoDeploy принимает модели Transformers без необходимости каких-либо изменений. Он автоматически преобразует модель в оптимизированный runtime.

Передайте идентификатор модели из Hub в build_and_run_ad.py, чтобы запустить модель Transformers.

cd examples/auto_deploy
python build_and_run_ad.py --model meta-llama/Llama-3.2-1B

Under 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 и компилирует модель в оптимизированный backend выполнения.

Ресурсы

Update on GitHub