vector-quantize-pytorch 1.19.1__tar.gz → 1.19.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.
Files changed (26) hide show
  1. {vector_quantize_pytorch-1.19.1 → vector_quantize_pytorch-1.19.2}/PKG-INFO +1 -31
  2. {vector_quantize_pytorch-1.19.1 → vector_quantize_pytorch-1.19.2}/README.md +0 -30
  3. {vector_quantize_pytorch-1.19.1 → vector_quantize_pytorch-1.19.2}/pyproject.toml +1 -1
  4. {vector_quantize_pytorch-1.19.1 → vector_quantize_pytorch-1.19.2}/vector_quantize_pytorch/residual_fsq.py +2 -2
  5. {vector_quantize_pytorch-1.19.1 → vector_quantize_pytorch-1.19.2}/.github/workflows/build.yml +0 -0
  6. {vector_quantize_pytorch-1.19.1 → vector_quantize_pytorch-1.19.2}/.github/workflows/python-publish.yml +0 -0
  7. {vector_quantize_pytorch-1.19.1 → vector_quantize_pytorch-1.19.2}/.github/workflows/test.yml +0 -0
  8. {vector_quantize_pytorch-1.19.1 → vector_quantize_pytorch-1.19.2}/.gitignore +0 -0
  9. {vector_quantize_pytorch-1.19.1 → vector_quantize_pytorch-1.19.2}/LICENSE +0 -0
  10. {vector_quantize_pytorch-1.19.1 → vector_quantize_pytorch-1.19.2}/examples/autoencoder.py +0 -0
  11. {vector_quantize_pytorch-1.19.1 → vector_quantize_pytorch-1.19.2}/examples/autoencoder_fsq.py +0 -0
  12. {vector_quantize_pytorch-1.19.1 → vector_quantize_pytorch-1.19.2}/examples/autoencoder_lfq.py +0 -0
  13. {vector_quantize_pytorch-1.19.1 → vector_quantize_pytorch-1.19.2}/images/fsq.png +0 -0
  14. {vector_quantize_pytorch-1.19.1 → vector_quantize_pytorch-1.19.2}/images/lfq.png +0 -0
  15. {vector_quantize_pytorch-1.19.1 → vector_quantize_pytorch-1.19.2}/images/vq.png +0 -0
  16. {vector_quantize_pytorch-1.19.1 → vector_quantize_pytorch-1.19.2}/ruff.toml +0 -0
  17. {vector_quantize_pytorch-1.19.1 → vector_quantize_pytorch-1.19.2}/tests/test_latent_quantization.py +0 -0
  18. {vector_quantize_pytorch-1.19.1 → vector_quantize_pytorch-1.19.2}/tests/test_readme.py +0 -0
  19. {vector_quantize_pytorch-1.19.1 → vector_quantize_pytorch-1.19.2}/vector_quantize_pytorch/__init__.py +0 -0
  20. {vector_quantize_pytorch-1.19.1 → vector_quantize_pytorch-1.19.2}/vector_quantize_pytorch/finite_scalar_quantization.py +0 -0
  21. {vector_quantize_pytorch-1.19.1 → vector_quantize_pytorch-1.19.2}/vector_quantize_pytorch/latent_quantization.py +0 -0
  22. {vector_quantize_pytorch-1.19.1 → vector_quantize_pytorch-1.19.2}/vector_quantize_pytorch/lookup_free_quantization.py +0 -0
  23. {vector_quantize_pytorch-1.19.1 → vector_quantize_pytorch-1.19.2}/vector_quantize_pytorch/random_projection_quantizer.py +0 -0
  24. {vector_quantize_pytorch-1.19.1 → vector_quantize_pytorch-1.19.2}/vector_quantize_pytorch/residual_lfq.py +0 -0
  25. {vector_quantize_pytorch-1.19.1 → vector_quantize_pytorch-1.19.2}/vector_quantize_pytorch/residual_vq.py +0 -0
  26. {vector_quantize_pytorch-1.19.1 → vector_quantize_pytorch-1.19.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.19.1
3
+ Version: 1.19.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
@@ -144,25 +144,6 @@ quantized, indices, commit_loss = residual_vq(x)
144
144
  # (1, 1024, 256), (2, 1, 1024, 8), (2, 1, 8)
145
145
  ```
146
146
 
147
-
148
- <a href="https://arxiv.org/abs/2305.05065">This paper</a> out of Google Deepmind claims that residual vector quantization can induce hierarchical semantic ids for building a recommender system. In their scheme, they use increasing number of codes across depth for it to work. This repository supports that scheme as so
149
-
150
- ```python
151
- import torch
152
- from vector_quantize_pytorch import ResidualVQ
153
-
154
- residual_vq = ResidualVQ(
155
- dim = 256,
156
- codebook_size = (5, 128, 256), # from top most hierarchy to lowest, 5 codes, 128 codes, then 256 codes
157
- )
158
-
159
- x = torch.randn(2, 16, 256)
160
-
161
- quantized, indices, commit_loss = residual_vq(x)
162
-
163
- # (2, 16, 256), (2, 16, 3), (2, 3)
164
- ```
165
-
166
147
  ## Initialization
167
148
 
168
149
  The SoundStream paper proposes that the codebook should be initialized by the kmeans centroids of the first batch. You can easily turn on this feature with one flag `kmeans_init = True`, for either `VectorQuantize` or `ResidualVQ` class
@@ -777,14 +758,3 @@ assert loss.item() >= 0
777
758
  url = {https://api.semanticscholar.org/CorpusID:273229218}
778
759
  }
779
760
  ```
780
-
781
- ```bibtex
782
- @article{Rajput2023RecommenderSW,
783
- title = {Recommender Systems with Generative Retrieval},
784
- author = {Shashank Rajput and Nikhil Mehta and Anima Singh and Raghunandan H. Keshavan and Trung Hieu Vu and Lukasz Heldt and Lichan Hong and Yi Tay and Vinh Q. Tran and Jonah Samost and Maciej Kula and Ed H. Chi and Maheswaran Sathiamoorthy},
785
- journal = {ArXiv},
786
- year = {2023},
787
- volume = {abs/2305.05065},
788
- url = {https://api.semanticscholar.org/CorpusID:258564854}
789
- }
790
- ```
@@ -100,25 +100,6 @@ quantized, indices, commit_loss = residual_vq(x)
100
100
  # (1, 1024, 256), (2, 1, 1024, 8), (2, 1, 8)
101
101
  ```
102
102
 
103
-
104
- <a href="https://arxiv.org/abs/2305.05065">This paper</a> out of Google Deepmind claims that residual vector quantization can induce hierarchical semantic ids for building a recommender system. In their scheme, they use increasing number of codes across depth for it to work. This repository supports that scheme as so
105
-
106
- ```python
107
- import torch
108
- from vector_quantize_pytorch import ResidualVQ
109
-
110
- residual_vq = ResidualVQ(
111
- dim = 256,
112
- codebook_size = (5, 128, 256), # from top most hierarchy to lowest, 5 codes, 128 codes, then 256 codes
113
- )
114
-
115
- x = torch.randn(2, 16, 256)
116
-
117
- quantized, indices, commit_loss = residual_vq(x)
118
-
119
- # (2, 16, 256), (2, 16, 3), (2, 3)
120
- ```
121
-
122
103
  ## Initialization
123
104
 
124
105
  The SoundStream paper proposes that the codebook should be initialized by the kmeans centroids of the first batch. You can easily turn on this feature with one flag `kmeans_init = True`, for either `VectorQuantize` or `ResidualVQ` class
@@ -733,14 +714,3 @@ assert loss.item() >= 0
733
714
  url = {https://api.semanticscholar.org/CorpusID:273229218}
734
715
  }
735
716
  ```
736
-
737
- ```bibtex
738
- @article{Rajput2023RecommenderSW,
739
- title = {Recommender Systems with Generative Retrieval},
740
- author = {Shashank Rajput and Nikhil Mehta and Anima Singh and Raghunandan H. Keshavan and Trung Hieu Vu and Lukasz Heldt and Lichan Hong and Yi Tay and Vinh Q. Tran and Jonah Samost and Maciej Kula and Ed H. Chi and Maheswaran Sathiamoorthy},
741
- journal = {ArXiv},
742
- year = {2023},
743
- volume = {abs/2305.05065},
744
- url = {https://api.semanticscholar.org/CorpusID:258564854}
745
- }
746
- ```
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "vector-quantize-pytorch"
3
- version = "1.19.1"
3
+ version = "1.19.2"
4
4
  description = "Vector Quantization - Pytorch"
5
5
  authors = [
6
6
  { name = "Phil Wang", email = "lucidrains@gmail.com" }
@@ -36,8 +36,8 @@ def round_up_multiple(num, mult):
36
36
  def is_distributed():
37
37
  return dist.is_initialized() and dist.get_world_size() > 1
38
38
 
39
- def get_maybe_sync_seed(max_size = 10_000):
40
- rand_int = torch.randint(0, max_size, ())
39
+ def get_maybe_sync_seed(device, max_size = 10_000):
40
+ rand_int = torch.randint(0, max_size, (), device = device)
41
41
 
42
42
  if is_distributed():
43
43
  dist.all_reduce(rand_int)