Skip to main content

MaskBit

Project description

MaskBit - Pytorch (wip)

Implementation of the proposed MaskBit from Bytedance AI

This paper can be viewed as a modernized version of the architecture from Taming Transformers from Esser et al.

They use the binary scalar quantization proposed in MagVit2 in their autoencoder, and then non-autoregressive mask decoding, where the masking is setting the bit (-1 or +1) to 0, projected for the transformer without explicit embeddings for the trit

Usage

import torch
from maskbit_pytorch import BQVAE, MaskBit

images = torch.randn(1, 3, 64, 64)

# train vae

vae = BQVAE(
    image_size = 64,
    dim = 512
)

loss = vae(images, return_loss = True)
loss.backward()

# train maskbit

maskbit = MaskBit(
    vae,
    dim = 512,
    bits_group_size = 512,
    depth = 2
)

loss = maskbit(images)
loss.backward()

# after much training

sampled_image = maskbit.sample() # (1, 3, 64, 64)

Citations

@inproceedings{Weber2024MaskBitEI,
    title   = {MaskBit: Embedding-free Image Generation via Bit Tokens},
    author  = {Mark Weber and Lijun Yu and Qihang Yu and Xueqing Deng and Xiaohui Shen and Daniel Cremers and Liang-Chieh Chen},
    year    = {2024},
    url     = {https://api.semanticscholar.org/CorpusID:272832013}
}

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

maskbit_pytorch-0.0.2.tar.gz (285.9 kB view details)

Uploaded Source

Built Distribution

maskbit_pytorch-0.0.2-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file maskbit_pytorch-0.0.2.tar.gz.

File metadata

  • Download URL: maskbit_pytorch-0.0.2.tar.gz
  • Upload date:
  • Size: 285.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for maskbit_pytorch-0.0.2.tar.gz
Algorithm Hash digest
SHA256 8e4ff775594d0bf11822352ab423f9ad543eb0d5137ff59f91a7d654b5dd55bf
MD5 84c9678ff54dce944e5d10fe16f2e979
BLAKE2b-256 2270e71008d095a51c62623618e262bdc2ab170aad2b78d3c046a3f1f7891ac7

See more details on using hashes here.

File details

Details for the file maskbit_pytorch-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for maskbit_pytorch-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9d5a48b99faaad5cf5d4d5096de782188c2adba2d156ea7175bb333261b3fc3d
MD5 17e5987d582fa8086c1c48d5eec4824a
BLAKE2b-256 9f4c9c2ed1c2440c76c902c71c83d52c4717010acee26f14ea5a9a05ff254710

See more details on using hashes here.

Supported by

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