Giter Site home page Giter Site logo

fastldm's Introduction

FastLDM

We focus on inference speed-up for ldm.

TensorRT

We are now trying to convert model of stable-diffusion into an optimized TensorRT engine. See examples/ folder for use cases.

When we transform a PyTorch model to TensorRT engine, we usually follow "torch->onnx->trt" footprint. It is convenient for most cases, except when we want to use plugins. If we want to use plugins, we usually need to modify the exported onnx file based on TensorRT official demo. The core idea of this repo is to provide a shortcut. We provide many plugin-friendly PyTorch modules, which can plug into your normal PyTorch model and export onnx directly able to be optimized by TensorRT with plugins.

The advantages of this repo are:

  • Seamlessly transform from PyTorch to TensorRT with plugins.
  • Seamlessly export onnx to run directly in onnxruntime.

More specifically, we provide:

  • parameter mapping functions from a module to another one in utils.mapping and utils.modifier
  • TensorRT-friendly modules in utils.plugins and utils.modules
  • benchmarking functions in utils.benchmark
  • experiment functions to compare different implemented models with same interface

Install

pip install -e .

or

pip install git+https://github.com/THUDM/FastLDM.git

Environment

We rely on the docker environment nvcr.io/nvidia/pytorch:22.12-py3. (For newer version of TensorRT, this repo may not work because of removement of plugins.)

fastldm's People

Contributors

1049451037 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

fastldm's Issues

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.