vector-quantize-pytorch 1.20.1__tar.gz → 1.20.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/PKG-INFO +1 -1
- {vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/pyproject.toml +1 -1
- {vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/vector_quantize_pytorch/sim_vq.py +12 -1
- {vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/.github/workflows/build.yml +0 -0
- {vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/.github/workflows/python-publish.yml +0 -0
- {vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/.github/workflows/test.yml +0 -0
- {vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/.gitignore +0 -0
- {vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/LICENSE +0 -0
- {vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/README.md +0 -0
- {vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/examples/autoencoder.py +0 -0
- {vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/examples/autoencoder_fsq.py +0 -0
- {vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/examples/autoencoder_lfq.py +0 -0
- {vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/examples/autoencoder_sim_vq.py +0 -0
- {vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/images/fsq.png +0 -0
- {vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/images/lfq.png +0 -0
- {vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/images/vq.png +0 -0
- {vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/ruff.toml +0 -0
- {vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/tests/test_latent_quantization.py +0 -0
- {vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/tests/test_readme.py +0 -0
- {vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/vector_quantize_pytorch/__init__.py +0 -0
- {vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/vector_quantize_pytorch/finite_scalar_quantization.py +0 -0
- {vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/vector_quantize_pytorch/latent_quantization.py +0 -0
- {vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/vector_quantize_pytorch/lookup_free_quantization.py +0 -0
- {vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/vector_quantize_pytorch/random_projection_quantizer.py +0 -0
- {vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/vector_quantize_pytorch/residual_fsq.py +0 -0
- {vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/vector_quantize_pytorch/residual_lfq.py +0 -0
- {vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/vector_quantize_pytorch/residual_vq.py +0 -0
- {vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/vector_quantize_pytorch/utils.py +0 -0
- {vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/vector_quantize_pytorch/vector_quantize_pytorch.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: vector-quantize-pytorch
|
|
3
|
-
Version: 1.20.
|
|
3
|
+
Version: 1.20.2
|
|
4
4
|
Summary: Vector Quantization - Pytorch
|
|
5
5
|
Project-URL: Homepage, https://pypi.org/project/vector-quantize-pytorch/
|
|
6
6
|
Project-URL: Repository, https://github.com/lucidrains/vector-quantizer-pytorch
|
{vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/vector_quantize_pytorch/sim_vq.py
RENAMED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
1
2
|
from typing import Callable
|
|
2
3
|
|
|
3
4
|
import torch
|
|
@@ -38,6 +39,7 @@ class SimVQ(Module):
|
|
|
38
39
|
self,
|
|
39
40
|
dim,
|
|
40
41
|
codebook_size,
|
|
42
|
+
codebook_transform: Module | None = None,
|
|
41
43
|
init_fn: Callable = identity,
|
|
42
44
|
accept_image_fmap = False,
|
|
43
45
|
rotation_trick = True, # works even better with rotation trick turned on, with no straight through and the commit loss from input to quantize
|
|
@@ -51,7 +53,11 @@ class SimVQ(Module):
|
|
|
51
53
|
|
|
52
54
|
# the codebook is actually implicit from a linear layer from frozen gaussian or uniform
|
|
53
55
|
|
|
54
|
-
|
|
56
|
+
if not exists(codebook_transform):
|
|
57
|
+
codebook_transform = nn.Linear(dim, dim, bias = False)
|
|
58
|
+
|
|
59
|
+
self.codebook_to_codes = codebook_transform
|
|
60
|
+
|
|
55
61
|
self.register_buffer('codebook', codebook)
|
|
56
62
|
|
|
57
63
|
|
|
@@ -114,6 +120,11 @@ if __name__ == '__main__':
|
|
|
114
120
|
|
|
115
121
|
sim_vq = SimVQ(
|
|
116
122
|
dim = 512,
|
|
123
|
+
codebook_transform = nn.Sequential(
|
|
124
|
+
nn.Linear(512, 1024),
|
|
125
|
+
nn.ReLU(),
|
|
126
|
+
nn.Linear(1024, 512)
|
|
127
|
+
),
|
|
117
128
|
codebook_size = 1024,
|
|
118
129
|
accept_image_fmap = True
|
|
119
130
|
)
|
{vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/.github/workflows/build.yml
RENAMED
|
File without changes
|
|
File without changes
|
{vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/.github/workflows/test.yml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/examples/autoencoder_fsq.py
RENAMED
|
File without changes
|
{vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/examples/autoencoder_lfq.py
RENAMED
|
File without changes
|
{vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/examples/autoencoder_sim_vq.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/tests/test_latent_quantization.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{vector_quantize_pytorch-1.20.1 → vector_quantize_pytorch-1.20.2}/vector_quantize_pytorch/utils.py
RENAMED
|
File without changes
|
|
File without changes
|