vector-quantize-pytorch 1.18.2__tar.gz → 1.18.3__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.18.2 → vector_quantize_pytorch-1.18.3}/PKG-INFO +1 -1
- {vector_quantize_pytorch-1.18.2 → vector_quantize_pytorch-1.18.3}/pyproject.toml +1 -1
- {vector_quantize_pytorch-1.18.2 → vector_quantize_pytorch-1.18.3}/vector_quantize_pytorch/lookup_free_quantization.py +10 -1
- {vector_quantize_pytorch-1.18.2 → vector_quantize_pytorch-1.18.3}/.github/workflows/build.yml +0 -0
- {vector_quantize_pytorch-1.18.2 → vector_quantize_pytorch-1.18.3}/.github/workflows/python-publish.yml +0 -0
- {vector_quantize_pytorch-1.18.2 → vector_quantize_pytorch-1.18.3}/.github/workflows/test.yml +0 -0
- {vector_quantize_pytorch-1.18.2 → vector_quantize_pytorch-1.18.3}/.gitignore +0 -0
- {vector_quantize_pytorch-1.18.2 → vector_quantize_pytorch-1.18.3}/LICENSE +0 -0
- {vector_quantize_pytorch-1.18.2 → vector_quantize_pytorch-1.18.3}/README.md +0 -0
- {vector_quantize_pytorch-1.18.2 → vector_quantize_pytorch-1.18.3}/examples/autoencoder.py +0 -0
- {vector_quantize_pytorch-1.18.2 → vector_quantize_pytorch-1.18.3}/examples/autoencoder_fsq.py +0 -0
- {vector_quantize_pytorch-1.18.2 → vector_quantize_pytorch-1.18.3}/examples/autoencoder_lfq.py +0 -0
- {vector_quantize_pytorch-1.18.2 → vector_quantize_pytorch-1.18.3}/images/fsq.png +0 -0
- {vector_quantize_pytorch-1.18.2 → vector_quantize_pytorch-1.18.3}/images/lfq.png +0 -0
- {vector_quantize_pytorch-1.18.2 → vector_quantize_pytorch-1.18.3}/images/vq.png +0 -0
- {vector_quantize_pytorch-1.18.2 → vector_quantize_pytorch-1.18.3}/ruff.toml +0 -0
- {vector_quantize_pytorch-1.18.2 → vector_quantize_pytorch-1.18.3}/tests/test_latent_quantization.py +0 -0
- {vector_quantize_pytorch-1.18.2 → vector_quantize_pytorch-1.18.3}/tests/test_readme.py +0 -0
- {vector_quantize_pytorch-1.18.2 → vector_quantize_pytorch-1.18.3}/vector_quantize_pytorch/__init__.py +0 -0
- {vector_quantize_pytorch-1.18.2 → vector_quantize_pytorch-1.18.3}/vector_quantize_pytorch/finite_scalar_quantization.py +0 -0
- {vector_quantize_pytorch-1.18.2 → vector_quantize_pytorch-1.18.3}/vector_quantize_pytorch/latent_quantization.py +0 -0
- {vector_quantize_pytorch-1.18.2 → vector_quantize_pytorch-1.18.3}/vector_quantize_pytorch/random_projection_quantizer.py +0 -0
- {vector_quantize_pytorch-1.18.2 → vector_quantize_pytorch-1.18.3}/vector_quantize_pytorch/residual_fsq.py +0 -0
- {vector_quantize_pytorch-1.18.2 → vector_quantize_pytorch-1.18.3}/vector_quantize_pytorch/residual_lfq.py +0 -0
- {vector_quantize_pytorch-1.18.2 → vector_quantize_pytorch-1.18.3}/vector_quantize_pytorch/residual_vq.py +0 -0
- {vector_quantize_pytorch-1.18.2 → vector_quantize_pytorch-1.18.3}/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.18.
|
|
3
|
+
Version: 1.18.3
|
|
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
|
|
@@ -103,6 +103,7 @@ class LFQ(Module):
|
|
|
103
103
|
commitment_loss_weight = 0.,
|
|
104
104
|
diversity_gamma = 1.,
|
|
105
105
|
straight_through_activation = nn.Identity(),
|
|
106
|
+
scale_trick = False, # @cfifty Fifty et al. https://arxiv.org/abs/2410.06424
|
|
106
107
|
num_codebooks = 1,
|
|
107
108
|
keep_num_codebooks_dim = None,
|
|
108
109
|
codebook_scale = 1., # for residual LFQ, codebook scaled down by 2x at each layer
|
|
@@ -160,6 +161,9 @@ class LFQ(Module):
|
|
|
160
161
|
|
|
161
162
|
self.activation = straight_through_activation
|
|
162
163
|
|
|
164
|
+
assert not (scale_trick and spherical)
|
|
165
|
+
self.scale_trick = scale_trick
|
|
166
|
+
|
|
163
167
|
# whether to use BSQ (binary spherical quantization)
|
|
164
168
|
|
|
165
169
|
self.spherical = spherical
|
|
@@ -322,7 +326,12 @@ class LFQ(Module):
|
|
|
322
326
|
|
|
323
327
|
if self.training:
|
|
324
328
|
x = self.activation(x)
|
|
325
|
-
|
|
329
|
+
|
|
330
|
+
if self.scale_trick:
|
|
331
|
+
x = x * (quantized / x).detach()
|
|
332
|
+
else:
|
|
333
|
+
x = x + (quantized - x).detach()
|
|
334
|
+
|
|
326
335
|
else:
|
|
327
336
|
x = quantized
|
|
328
337
|
|
{vector_quantize_pytorch-1.18.2 → vector_quantize_pytorch-1.18.3}/.github/workflows/build.yml
RENAMED
|
File without changes
|
|
File without changes
|
{vector_quantize_pytorch-1.18.2 → vector_quantize_pytorch-1.18.3}/.github/workflows/test.yml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{vector_quantize_pytorch-1.18.2 → vector_quantize_pytorch-1.18.3}/examples/autoencoder_fsq.py
RENAMED
|
File without changes
|
{vector_quantize_pytorch-1.18.2 → vector_quantize_pytorch-1.18.3}/examples/autoencoder_lfq.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{vector_quantize_pytorch-1.18.2 → vector_quantize_pytorch-1.18.3}/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
|