Skip to main content

A PyTorch library for multi-modal image translation with diffusion bridges, GANs, and transformer backbones.

Project description

pytorch-image-translation-models

License: MIT PyPI version Checkpoint Collections

A PyTorch library for multi-modal image translation with diffusion bridges, GANs, and transformer backbones.

Installation

Install from PyPI

pip install pytorch-image-translation-models

Install from source

pip install -e .

With optional dependencies:

# With training extras (accelerate, peft, datasets, tensorboard)
pip install -e ".[training]"

# With metrics extras (torchmetrics, lpips, torch-fidelity, scipy)
pip install -e ".[metrics]"

# Everything
pip install -e ".[all]"

Note: PyTorch is listed as a dependency but you may want to install a specific CUDA build first. See PyTorch — Get Started for details.

Quick Start

Examples default to device="cuda". If your environment is CPU-only, replace "cuda" with "cpu".

from PIL import Image

# Baseline method (UNSB)
from src.pipelines.unsb import UNSBPipeline
unsb = UNSBPipeline.from_pretrained(
    "path/to/UNSB-ckpt/horse2zebra",  # https://huggingface.co/BiliSakura/UNSB-ckpt
    subfolder="generator",
    scheduler_num_timesteps=5,
    scheduler_tau=0.01,
)
unsb.to("cuda")
unsb_out = unsb(source_image=source, output_type="pil")
unsb_out.images[0].save("unsb_output.png")

# Community method (DiffuseIT) - text/image-guided diffusion translation
from examples.community.diffuseit import load_diffuseit_community_pipeline

pipe = load_diffuseit_community_pipeline(
    "/path/to/BiliSakura/DiffuseIT-ckpt/imagenet256-uncond",
)
pipe.to("cuda")
out = pipe(
    source_image=source,
    prompt="Black Leopard",
    source="Lion",
    use_range_restart=True,
    use_noise_aug_all=True,
    output_type="pil",
)
out.images[0].save("diffuseit_output.png")

# Community method (E3Diff)
from examples.community.e3diff import E3DiffPipeline
e3diff = E3DiffPipeline.from_pretrained("path/to/E3Diff-ckpt/SEN12")
e3diff.to("cuda")
community_out = e3diff(source_image=source, num_inference_steps=50, output_type="pil")
community_out.images[0].save("e3diff_output.png")

Documentation

All information regarding per-method checkpoint folder conventions required by from_pretrained(...), as well as comprehensive package documentation, is integrated below.

Doc Description
Checkpoint layouts Provides detailed checkpoint folder structures, naming conventions, and requirements for each pipeline and the from_pretrained(...) API.
Features Documents supported models, schedulers, pipelines, data types, training methods, and evaluation metrics.
Metrics README One-stop usage for paired/unpaired metrics and custom HuggingFace/local checkpoints.
Datasets Common image-to-image translation datasets (pix2pix, CycleGAN) with paper and download links.
Examples Extended usage patterns and code snippets for pipelines such as I2SB, DDBM, UNSB, and Local Diffusion.
Storage Buckets Sync training checkpoints and TensorBoard logs to Hugging Face Storage Buckets (CUT, pix2pix tutorials).
Package structure Overview of the codebase organization, modules, and directories.
Credits Citations for reference papers and third-party contributions.

Credits

This repository/package is primarily built upon 4th-MAVIC-T by the EarthBridge Team:

License

MIT

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

pytorch_image_translation_models-0.5.1.tar.gz (318.3 kB view details)

Uploaded Source

Built Distribution

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

pytorch_image_translation_models-0.5.1-py3-none-any.whl (439.5 kB view details)

Uploaded Python 3

File details

Details for the file pytorch_image_translation_models-0.5.1.tar.gz.

File metadata

File hashes

Hashes for pytorch_image_translation_models-0.5.1.tar.gz
Algorithm Hash digest
SHA256 5552e4b6614a56de2701c013664fc1eed17d8de88682b178a31d0c7aae3cd1ca
MD5 2d69a796abb18eac3cd8d623720e77c2
BLAKE2b-256 bf1034f50ae0f4c6043d0669197c9ca44c536994698cca8906174ae29f7a56a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytorch_image_translation_models-0.5.1.tar.gz:

Publisher: publish.yml on Bili-Sakura/pytorch-image-translation-models

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytorch_image_translation_models-0.5.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pytorch_image_translation_models-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7585dd980eb571aaf04e326f84cbdfa2cca9e2a529c3571fc145fc220b4c169b
MD5 4b46a1cb7d3607143c56de5b75bbbe77
BLAKE2b-256 e7705beb3e929a311de0aae49e63b54e66452df0f2ab0c06341e44b188bdbede

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytorch_image_translation_models-0.5.1-py3-none-any.whl:

Publisher: publish.yml on Bili-Sakura/pytorch-image-translation-models

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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