GithubHelp home page GithubHelp logo

cactusq / tensorrt-llm-tutorial Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 87 KB

Getting started with TensorRT-LLM using BLOOM as a case study

License: MIT License

Jupyter Notebook 100.00%
deeplearning jupyter-notebook llm-inference llms tensorrt tensorrt-inference tensorrt-llm

tensorrt-llm-tutorial's Introduction

TensorRT-LLM: A Tutorial On Getting Started

Beginner-friendly tutorial for Tensor-RT-LLM using BLOOM-560M as an example model.

Video walkthrough and explanation:

Youtube video link

Accelerating BLOOM 560M Inference with TensorRT-LLM

This Jupyter notebook demonstrates the optimization of the BLOOM 560M model, a large language model, for faster inference using NVIDIA's TensorRT-LLM. The guide covers the installation of necessary tools, downloading and preparing the BLOOM model, and the steps to convert and optimize the model using TensorRT-LLM for both FP16 and INT8 quantization. It also includes a comparison of inference speed results between the baseline model from Huggingface, the optimized FP16 model, and the INT8 quantized model.

Prerequisites

  • NVIDIA GPU with CUDA support
  • Docker and NVIDIA Container Toolkit installed (will be installed in the notebook as well)
  • Python 3.10, pip, and necessary Python libraries
  • Jupyter or Google Colab

Or run the docker container and install Jupyter there:

docker run --rm --runtime=nvidia --gpus all --entrypoint /bin/bash -it nvidia/cuda:12.1.0-devel-ubuntu22.04

Overview

This notebook provides a detailed walkthrough for:

  • Installing the NVIDIA Container Toolkit: Ensures that Docker containers can utilize the full power of NVIDIA GPUs.
  • Installing TensorRT-LLM: Steps to clone the NVIDIA TensorRT-LLM repository and install the required Python packages.
  • Downloading BLOOM: Instructions to download the BLOOM 560M model from Huggingface.
  • Converting and Building the BLOOM Model: Processes to convert the BLOOM model from its original Huggingface format to a format compatible with TensorRT-LLM and optimize it for faster inference using FP16 and INT8 quantization.
  • Benchmarking: Compares execution time and ROUGE metrics for summarization tasks between the baseline Huggingface model and the optimized TensorRT-LLM models.

Key Steps

  • Model Loading and Conversion: Load the BLOOM 560M model and convert it to the TensorRT-LLM optimized format.
  • Accelerating Inference with TensorRT: The notebook demonstrates converting the BLOOM model to a TensorRT-optimized model, significantly reducing inference times.
  • Applying INT8 Quantization: Further optimization using INT8 quantization to reduce model size and accelerate inference speed, with a comparative analysis of performance impact.
  • Benchmarking and Results Analysis: In-depth comparison of inference speeds and performance metrics (like ROUGE scores) across the baseline, TensorRT-optimized, and INT8-quantized models. Visualizations included showcase the performance improvements.

Results

The notebook concludes with a comparative analysis showcasing the inference speed improvements and performance metrics. It provides a clear visualization of the speed-ups achieved through TensorRT optimization and INT8 quantization, highlighting the substantial decrease in inference time while maintaining or improving model performance.

Conclusion

This guide demonstrates the effectiveness of TensorRT-LLM in optimizing the BLOOM 560M model for faster inference. It serves as a valuable resource for AI practitioners looking to enhance the performance of large language models for real-world applications, making it especially useful for tasks requiring high throughput and low latency.

tensorrt-llm-tutorial's People

Contributors

cactusq avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.