Skip to main content

FlexTensor: Tensor offloading and management library

Project description

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, dev, optional dependencies), 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
    discovery_iters=1,            # Iterations for tensor discovery
    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 - first discovery_iters + profiling_iters iterations are discovery/profiling
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 additional notices and disclaimers regarding external materials.

Project details


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.2.0-py3-none-any.whl (191.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for flextensor-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fcf3ba60dc45ecc438841355fc85c5ccb75241637684d904f8b688c0cdca2249
MD5 f6289a9fd6117f1363af8c2532a0783c
BLAKE2b-256 28ec5416a8ca34bdeb5ba4cb6c0f3fa3fd04c9b9a8ea03f5e50df8178ea48e05

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page