vector-quantize-pytorch 1.16.1__tar.gz → 1.16.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.16.1 → vector_quantize_pytorch-1.16.2}/PKG-INFO +1 -1
- {vector_quantize_pytorch-1.16.1 → vector_quantize_pytorch-1.16.2}/pyproject.toml +1 -1
- {vector_quantize_pytorch-1.16.1 → vector_quantize_pytorch-1.16.2}/tests/test_readme.py +5 -8
- {vector_quantize_pytorch-1.16.1 → vector_quantize_pytorch-1.16.2}/vector_quantize_pytorch/vector_quantize_pytorch.py +1 -1
- {vector_quantize_pytorch-1.16.1 → vector_quantize_pytorch-1.16.2}/.github/workflows/build.yml +0 -0
- {vector_quantize_pytorch-1.16.1 → vector_quantize_pytorch-1.16.2}/.github/workflows/python-publish.yml +0 -0
- {vector_quantize_pytorch-1.16.1 → vector_quantize_pytorch-1.16.2}/.github/workflows/test.yml +0 -0
- {vector_quantize_pytorch-1.16.1 → vector_quantize_pytorch-1.16.2}/.gitignore +0 -0
- {vector_quantize_pytorch-1.16.1 → vector_quantize_pytorch-1.16.2}/LICENSE +0 -0
- {vector_quantize_pytorch-1.16.1 → vector_quantize_pytorch-1.16.2}/README.md +0 -0
- {vector_quantize_pytorch-1.16.1 → vector_quantize_pytorch-1.16.2}/examples/autoencoder.py +0 -0
- {vector_quantize_pytorch-1.16.1 → vector_quantize_pytorch-1.16.2}/examples/autoencoder_fsq.py +0 -0
- {vector_quantize_pytorch-1.16.1 → vector_quantize_pytorch-1.16.2}/examples/autoencoder_lfq.py +0 -0
- {vector_quantize_pytorch-1.16.1 → vector_quantize_pytorch-1.16.2}/images/fsq.png +0 -0
- {vector_quantize_pytorch-1.16.1 → vector_quantize_pytorch-1.16.2}/images/lfq.png +0 -0
- {vector_quantize_pytorch-1.16.1 → vector_quantize_pytorch-1.16.2}/images/vq.png +0 -0
- {vector_quantize_pytorch-1.16.1 → vector_quantize_pytorch-1.16.2}/ruff.toml +0 -0
- {vector_quantize_pytorch-1.16.1 → vector_quantize_pytorch-1.16.2}/tests/test_latent_quantization.py +0 -0
- {vector_quantize_pytorch-1.16.1 → vector_quantize_pytorch-1.16.2}/vector_quantize_pytorch/__init__.py +0 -0
- {vector_quantize_pytorch-1.16.1 → vector_quantize_pytorch-1.16.2}/vector_quantize_pytorch/finite_scalar_quantization.py +0 -0
- {vector_quantize_pytorch-1.16.1 → vector_quantize_pytorch-1.16.2}/vector_quantize_pytorch/latent_quantization.py +0 -0
- {vector_quantize_pytorch-1.16.1 → vector_quantize_pytorch-1.16.2}/vector_quantize_pytorch/lookup_free_quantization.py +0 -0
- {vector_quantize_pytorch-1.16.1 → vector_quantize_pytorch-1.16.2}/vector_quantize_pytorch/random_projection_quantizer.py +0 -0
- {vector_quantize_pytorch-1.16.1 → vector_quantize_pytorch-1.16.2}/vector_quantize_pytorch/residual_fsq.py +0 -0
- {vector_quantize_pytorch-1.16.1 → vector_quantize_pytorch-1.16.2}/vector_quantize_pytorch/residual_lfq.py +0 -0
- {vector_quantize_pytorch-1.16.1 → vector_quantize_pytorch-1.16.2}/vector_quantize_pytorch/residual_vq.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: vector-quantize-pytorch
|
|
3
|
-
Version: 1.16.
|
|
3
|
+
Version: 1.16.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
|
|
@@ -64,9 +64,11 @@ def test_vq_mask():
|
|
|
64
64
|
|
|
65
65
|
@pytest.mark.parametrize('implicit_neural_codebook', (True, False))
|
|
66
66
|
@pytest.mark.parametrize('use_cosine_sim', (True, False))
|
|
67
|
+
@pytest.mark.parametrize('train', (True, False))
|
|
67
68
|
def test_residual_vq(
|
|
68
69
|
implicit_neural_codebook,
|
|
69
|
-
use_cosine_sim
|
|
70
|
+
use_cosine_sim,
|
|
71
|
+
train
|
|
70
72
|
):
|
|
71
73
|
from vector_quantize_pytorch import ResidualVQ
|
|
72
74
|
|
|
@@ -80,14 +82,9 @@ def test_residual_vq(
|
|
|
80
82
|
|
|
81
83
|
x = torch.randn(1, 256, 32)
|
|
82
84
|
|
|
83
|
-
|
|
84
|
-
quantized, indices, commit_loss, all_codes = residual_vq(x, return_all_codes = True)
|
|
85
|
-
|
|
86
|
-
# test eval mode and `get_output_from_indices`
|
|
87
|
-
|
|
88
|
-
residual_vq.eval()
|
|
89
|
-
quantized, indices, commit_loss = residual_vq(x)
|
|
85
|
+
residual_vq.train(train)
|
|
90
86
|
|
|
87
|
+
quantized, indices, commit_loss = residual_vq(x, freeze_codebook = train and not implicit_neural_codebook)
|
|
91
88
|
quantized_out = residual_vq.get_output_from_indices(indices)
|
|
92
89
|
assert torch.allclose(quantized, quantized_out, atol = 1e-6)
|
|
93
90
|
|
|
@@ -751,7 +751,7 @@ class CosineSimCodebook(Module):
|
|
|
751
751
|
embed_normalized = self.embed_avg / rearrange(cluster_size, '... -> ... 1')
|
|
752
752
|
embed_normalized = l2norm(embed_normalized)
|
|
753
753
|
|
|
754
|
-
self.embed.data.copy_(
|
|
754
|
+
self.embed.data.copy_(embed_normalized)
|
|
755
755
|
self.expire_codes_(x)
|
|
756
756
|
|
|
757
757
|
if needs_codebook_dim:
|
{vector_quantize_pytorch-1.16.1 → vector_quantize_pytorch-1.16.2}/.github/workflows/build.yml
RENAMED
|
File without changes
|
|
File without changes
|
{vector_quantize_pytorch-1.16.1 → vector_quantize_pytorch-1.16.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.16.1 → vector_quantize_pytorch-1.16.2}/examples/autoencoder_fsq.py
RENAMED
|
File without changes
|
{vector_quantize_pytorch-1.16.1 → vector_quantize_pytorch-1.16.2}/examples/autoencoder_lfq.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{vector_quantize_pytorch-1.16.1 → vector_quantize_pytorch-1.16.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
|