Skip to main content

DiT (Diffusion Transformer)

Project description

PyPI - Version CI

dit_ml

The goal of dit_ml is to create a python repository to create the base model for diffusion transformer (https://arxiv.org/abs/2212.09748)

Also we incorporate RoPe embedding (for equivariance) taking inspiration from https://arxiv.org/pdf/2104.09864, https://arxiv.org/pdf/2403.13298 (2D mixed rope)

Installation

You can install dit_ml using pip:

pip install dit_ml

Usage

Here's a basic example of how to use dit_ml:

from dit_ml.dit import DiT

model = DiT(
    num_patches=input_size*input_size, # if 2d with flatten size
    hidden_size=hidden_size,
    depth=depth,
    num_heads=num_heads,
    learn_sigma=learn_sigma
)

dummy_x = torch.randn(batch_size, input_size * input_size, hidden_size)

dummy_c = torch.randn(batch_size, hidden_size) # Dummy conditioning vector

output = model(dummy_x, dummy_c) # of shape (batch_size, input_size * input_size, hidden_size)

Development

To set up the development environment:

  1. Clone the repository:
git clone https://github.com/Forbu/dit_ml.git
cd dit_ml
  1. Install dependencies using uv:
uv sync
  1. Run tests:
uv run pytest

Contributing

Contributions are welcome! Please see the LICENSE for details.

License

This project is licensed under the Apache 2.0 - see the LICENSE file for details.

Project details


Download files

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

Source Distribution

dit_ml-0.2.9.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

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

dit_ml-0.2.9-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file dit_ml-0.2.9.tar.gz.

File metadata

  • Download URL: dit_ml-0.2.9.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.3

File hashes

Hashes for dit_ml-0.2.9.tar.gz
Algorithm Hash digest
SHA256 f0a15f5581cfc3204256c10fb1d7bdb47e2a9a2acb15e1b5f809b2f48949a96f
MD5 856b0559e857c5498db292088cce4dda
BLAKE2b-256 60ada545252291228ada127e7d63b3b95bcefbb0074b606eeae9fd9fab33f7fb

See more details on using hashes here.

File details

Details for the file dit_ml-0.2.9-py3-none-any.whl.

File metadata

  • Download URL: dit_ml-0.2.9-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.3

File hashes

Hashes for dit_ml-0.2.9-py3-none-any.whl
Algorithm Hash digest
SHA256 d4ec7f1dd07603c5c5b4d6c73b6bcee55de5679fcef97a95a048f1a3d212cf7b
MD5 4fd1d6f912599e9eafe63b7ac20c1949
BLAKE2b-256 571fee884a9836d35de1d4b8c711fd85d3922eefebcf039f5a983de97f768829

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