Skip to main content

FlexTensor

Documentation Dashboard

FlexTensor is a tensor offloading and management library for PyTorch that enables running large models on limited GPU memory by intelligently offloading tensors between GPU and CPU memory.

Features

  • Simplified API: Easy-to-use high-level API for automatic tensor offloading
  • Automatic Model Patching: Offload model layers without modifying model code
  • Manual Control: Fine-grained control with offload_block context managers
  • Smart Profiling: Automatic discovery and profiling for optimal performance
  • Wildcard Support: Use patterns like "layers.*" to offload multiple modules
  • Profile Persistence: Save and load offloading profiles for faster startup
  • Lazy Model Initialization: Load models from saved profiles with optimized weight loading
  • Shared Memory: Optional shared memory subsystem for cross-process tensor coordination

Documentation

For detailed guides, API reference, and more, visit our Documentation.

Quick Installation

To install FlexTensor from PyPI:

pip install flextensor

For more installation options (source and development), see the Installation Guide.

Quick Example

import flextensor
from flextensor import OffloadConfig

# Your existing model
model = YourModel()

# Configure offloading
config = OffloadConfig(
    gpu_device=0,                   # GPU to use
    profiling_iters=10,             # Iterations for timing measurement
    include_patterns=["layers.*"],  # Which modules to offload
)

# Patch the model
model = flextensor.offload(model, config=config)

# Use normally — the first few iterations warm the manager
# (`discovery_iters` + `profiling_iters` under the default
# `skip_discovery=False`; query
# `flextensor.get_offload_manager().iters_before_inference` for
# the exact path-aware count).
for batch in dataloader:
    output = model(batch)  # FlexTensor handles everything

See the Quick Start for more examples.

License

FlexTensor is licensed under the Apache License 2.0. See NOTICE for the project notice, ATTRIBUTIONS.md for third-party dependency attributions, and EXTERNAL_MATERIALS.md for external materials.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flextensor-0.3.0-py3-none-any.whl (287.2 kB view details)

Uploaded Python 3

File details

Details for the file flextensor-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: flextensor-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 287.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for flextensor-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 22012fbe7009aff5acefe4945cfa0ed68afb8b3dc64b59b86e8d6a7f2beb9d35
MD5 47a4c280a364232fce9b079624514637
BLAKE2b-256 01e03ed876bad32258384b07f74f7ded8d802aee7458db9ee16acd7fa4685f90

See more details on using hashes here.

Release history Release notifications | RSS feed

0.4.0

1 file

This release

0.3.0 This release

1 file

0.2.1

1 file

0.2.0

1 file

0.1.0

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page