Skip to content

A raccoon holding a circuit board in a trash can

trash-panda

Run models bigger than your GPU: stream weights layer by layer across GPU, RAM and disk.

Quick start API reference GitHub

  • Quick start

    From install to a first run, in a few minutes.

  • Running a stage

    Load, run and release one model.

  • Running a pipeline

    Several models one after another, with the next one loading while the current one runs.

  • API reference

    Every public function and class, with its parameters and defaults.

  • Design

    How it works in detail, and the measurements behind the defaults.

Why

Loading a big checkpoint the usual way needs two full copies in RAM, and a model that does not fit in VRAM simply fails. trash-panda builds the model without allocating weights (meta device), reads the checkpoint tensor by tensor, and keeps each block of the model wherever it fits best:

Tier Where the block waits Cost per forward pass
gpu on the GPU, in compact form (for example fp8) only the expansion to bf16
ram in system RAM, in compact form a transfer over PCIe
disk in the checkpoint file a file read

Only one block at a time is expanded to the compute dtype, so peak VRAM is roughly one block plus your activations, whatever the model size.

Install

Install PyTorch first (the build that matches your GPU, see pytorch.org), then:

pip install dumpsterpanda

The package is imported as trash_panda.