Installing on Grace Hopper#
Install TensorRT-LLM (tested on Ubuntu 24.04).
pip3 install torch==2.7.1 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128 sudo apt-get -y install libopenmpi-dev && pip3 install --upgrade pip setuptools && pip3 install tensorrt_llm
If using the PyTorch NGC Container image, the prerequisite steps for installing CUDA-enabled PyTorch package and
libopenmpi-dev
are not required.Sanity check the installation by running the following in Python (tested on Python 3.12):
1from tensorrt_llm import SamplingParams 2from tensorrt_llm._tensorrt_engine import LLM 3 4 5def main(): 6 7 prompts = [ 8 "Hello, my name is", 9 "The president of the United States is", 10 "The capital of France is", 11 "The future of AI is", 12 ] 13 sampling_params = SamplingParams(temperature=0.8, top_p=0.95) 14 15 llm = LLM(model="TinyLlama/TinyLlama-1.1B-Chat-v1.0") 16 17 outputs = llm.generate(prompts, sampling_params) 18 19 # Print the outputs. 20 for output in outputs: 21 prompt = output.prompt 22 generated_text = output.outputs[0].text 23 print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}") 24 25 26# The entry point of the program need to be protected for spawning processes. 27if __name__ == '__main__': 28 main()