Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
lucidrains committed Jun 19, 2024
1 parent 166a38f commit 6dcc12b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ loss.backward()
# after much training
# extract codes for gpt, maskgit, whatever

codes = titok.tokenize(images)
codes = titok.tokenize(images) # (2, 32)

# reconstructing images from codes

Expand Down
7 changes: 6 additions & 1 deletion tests/test_titok.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ def test_titok():

images = torch.randn(2, 3, 256, 256)

titok = TiTokTokenizer(dim = 512)
titok = TiTokTokenizer(
dim = 512,
num_latent_tokens = 32
)

loss = titok(images)
loss.backward()
Expand All @@ -16,6 +19,8 @@ def test_titok():

codes = titok.tokenize(images)

assert codes.shape == (2, 32)

# reconstructing images from codes

recon_images = titok.codebook_ids_to_images(codes)
Expand Down

0 comments on commit 6dcc12b

Please sign in to comment.