Skip to content
Projects

lucidrains/maskbit-pytorch has 82 GitHub stars and 1 forks. GitHot measured 0 stars in 24 hours, 0 in 7 days, and 0 in 15 days. Last checked 2026-11-15 07:30 UTC. Last push 2024-11-12.

How these counts are measured

Measured star growth

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

About

Implementation of the proposed MaskBit from Bytedance AI

AI

README.md

Original

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}
}