TiTok - Pytorch
Project description
TiTok - Pytorch (wip)
Implementation of TiTok, proposed by Bytedance in An Image is Worth 32 Tokens for Reconstruction and Generation
Usage
import torch
from titok_pytorch.titok import TiTokTokenizer
images = torch.randn(2, 3, 256, 256)
titok = TiTokTokenizer(dim = 512)
loss = titok(images)
loss.backward()
# after much training
# extract codes for gpt, maskgit, whatever
codes = titok.tokenize(images)
# reconstructing images from codes
recon_images = titok.codebook_ids_to_images(codes)
assert recon_images.shape == images.shape
Citations
@article{yu2024an,
author = {Qihang Yu and Mark Weber and Xueqing Deng and Xiaohui Shen and Daniel Cremers and Liang-Chieh Chen},
title = {An Image is Worth 32 Tokens for Reconstruction and Generation},
journal = {arxiv: 2406.07550},
year = {2024}
}
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
titok_pytorch-0.0.2.tar.gz
(1.3 MB
view details)
Built Distribution
File details
Details for the file titok_pytorch-0.0.2.tar.gz
.
File metadata
- Download URL: titok_pytorch-0.0.2.tar.gz
- Upload date:
- Size: 1.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7264ed151398064e1fe6a8365498dbc3049c84f9f4f3503fb3af2c4b884a9397 |
|
MD5 | cc7055f96033dddc2906ebe032a3e4d7 |
|
BLAKE2b-256 | 3545d56481eabb3750071433ed8fb66c858f4a6858e1858ad7fee8721196ec01 |
File details
Details for the file titok_pytorch-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: titok_pytorch-0.0.2-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2845967f7173a78549343a6af1f02fac082c717882cf72c8e1aaeae679d733e |
|
MD5 | 452d68f2466b5b8364d05032dc8e8442 |
|
BLAKE2b-256 | 7a8393ca684d73e439211260d9e5e88184c57ab00cfbb9869e2bf3c08aadf903 |