vector-quantize-pytorch 1.18.7__tar.gz → 1.18.8__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.18.7 → vector_quantize_pytorch-1.18.8}/PKG-INFO +1 -1
  2. {vector_quantize_pytorch-1.18.7 → vector_quantize_pytorch-1.18.8}/pyproject.toml +1 -1
  3. {vector_quantize_pytorch-1.18.7 → vector_quantize_pytorch-1.18.8}/vector_quantize_pytorch/residual_fsq.py +3 -3
  4. {vector_quantize_pytorch-1.18.7 → vector_quantize_pytorch-1.18.8}/vector_quantize_pytorch/residual_lfq.py +5 -5
  5. {vector_quantize_pytorch-1.18.7 → vector_quantize_pytorch-1.18.8}/vector_quantize_pytorch/residual_vq.py +5 -5
  6. {vector_quantize_pytorch-1.18.7 → vector_quantize_pytorch-1.18.8}/.github/workflows/build.yml +0 -0
  7. {vector_quantize_pytorch-1.18.7 → vector_quantize_pytorch-1.18.8}/.github/workflows/python-publish.yml +0 -0
  8. {vector_quantize_pytorch-1.18.7 → vector_quantize_pytorch-1.18.8}/.github/workflows/test.yml +0 -0
  9. {vector_quantize_pytorch-1.18.7 → vector_quantize_pytorch-1.18.8}/.gitignore +0 -0
  10. {vector_quantize_pytorch-1.18.7 → vector_quantize_pytorch-1.18.8}/LICENSE +0 -0
  11. {vector_quantize_pytorch-1.18.7 → vector_quantize_pytorch-1.18.8}/README.md +0 -0
  12. {vector_quantize_pytorch-1.18.7 → vector_quantize_pytorch-1.18.8}/examples/autoencoder.py +0 -0
  13. {vector_quantize_pytorch-1.18.7 → vector_quantize_pytorch-1.18.8}/examples/autoencoder_fsq.py +0 -0
  14. {vector_quantize_pytorch-1.18.7 → vector_quantize_pytorch-1.18.8}/examples/autoencoder_lfq.py +0 -0
  15. {vector_quantize_pytorch-1.18.7 → vector_quantize_pytorch-1.18.8}/images/fsq.png +0 -0
  16. {vector_quantize_pytorch-1.18.7 → vector_quantize_pytorch-1.18.8}/images/lfq.png +0 -0
  17. {vector_quantize_pytorch-1.18.7 → vector_quantize_pytorch-1.18.8}/images/vq.png +0 -0
  18. {vector_quantize_pytorch-1.18.7 → vector_quantize_pytorch-1.18.8}/ruff.toml +0 -0
  19. {vector_quantize_pytorch-1.18.7 → vector_quantize_pytorch-1.18.8}/tests/test_latent_quantization.py +0 -0
  20. {vector_quantize_pytorch-1.18.7 → vector_quantize_pytorch-1.18.8}/tests/test_readme.py +0 -0
  21. {vector_quantize_pytorch-1.18.7 → vector_quantize_pytorch-1.18.8}/vector_quantize_pytorch/__init__.py +0 -0
  22. {vector_quantize_pytorch-1.18.7 → vector_quantize_pytorch-1.18.8}/vector_quantize_pytorch/finite_scalar_quantization.py +0 -0
  23. {vector_quantize_pytorch-1.18.7 → vector_quantize_pytorch-1.18.8}/vector_quantize_pytorch/latent_quantization.py +0 -0
  24. {vector_quantize_pytorch-1.18.7 → vector_quantize_pytorch-1.18.8}/vector_quantize_pytorch/lookup_free_quantization.py +0 -0
  25. {vector_quantize_pytorch-1.18.7 → vector_quantize_pytorch-1.18.8}/vector_quantize_pytorch/random_projection_quantizer.py +0 -0
  26. {vector_quantize_pytorch-1.18.7 → vector_quantize_pytorch-1.18.8}/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.7
3
+ Version: 1.18.8
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
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "vector-quantize-pytorch"
3
- version = "1.18.7"
3
+ version = "1.18.8"
4
4
  description = "Vector Quantization - Pytorch"
5
5
  authors = [
6
6
  { name = "Phil Wang", email = "lucidrains@gmail.com" }
@@ -185,7 +185,7 @@ class ResidualFSQ(Module):
185
185
  # check if seed is manually passed in
186
186
 
187
187
  if not exists(rand_quantize_dropout_fixed_seed):
188
- rand_quantize_dropout_fixed_seed = get_maybe_sync_seed()
188
+ rand_quantize_dropout_fixed_seed = get_maybe_sync_seed(device)
189
189
 
190
190
  rand = random.Random(rand_quantize_dropout_fixed_seed)
191
191
 
@@ -296,7 +296,7 @@ class GroupedResidualFSQ(Module):
296
296
  x,
297
297
  return_all_codes = False
298
298
  ):
299
- shape, split_dim = x.shape, self.split_dim
299
+ shape, split_dim, device = x.shape, self.split_dim, x.device
300
300
  assert shape[split_dim] == self.dim
301
301
 
302
302
  # split the feature dimension into groups
@@ -305,7 +305,7 @@ class GroupedResidualFSQ(Module):
305
305
 
306
306
  forward_kwargs = dict(
307
307
  return_all_codes = return_all_codes,
308
- rand_quantize_dropout_fixed_seed = get_maybe_sync_seed()
308
+ rand_quantize_dropout_fixed_seed = get_maybe_sync_seed(device)
309
309
  )
310
310
 
311
311
  # invoke residual vq on each group
@@ -31,8 +31,8 @@ def round_up_multiple(num, mult):
31
31
  def is_distributed():
32
32
  return dist.is_initialized() and dist.get_world_size() > 1
33
33
 
34
- def get_maybe_sync_seed(max_size = 10_000):
35
- rand_int = torch.randint(0, max_size, ())
34
+ def get_maybe_sync_seed(device, max_size = 10_000):
35
+ rand_int = torch.randint(0, max_size, (), device = device)
36
36
 
37
37
  if is_distributed():
38
38
  dist.all_reduce(rand_int)
@@ -162,7 +162,7 @@ class ResidualLFQ(Module):
162
162
  # check if seed is manually passed in
163
163
 
164
164
  if not exists(rand_quantize_dropout_fixed_seed):
165
- rand_quantize_dropout_fixed_seed = get_maybe_sync_seed()
165
+ rand_quantize_dropout_fixed_seed = get_maybe_sync_seed(device)
166
166
 
167
167
  rand = random.Random(rand_quantize_dropout_fixed_seed)
168
168
 
@@ -262,7 +262,7 @@ class GroupedResidualLFQ(Module):
262
262
  mask = None,
263
263
  return_all_codes = False
264
264
  ):
265
- shape, split_dim = x.shape, self.split_dim
265
+ shape, split_dim, device = x.shape, self.split_dim, x.device
266
266
  assert shape[split_dim] == self.dim
267
267
 
268
268
  # split the feature dimension into groups
@@ -272,7 +272,7 @@ class GroupedResidualLFQ(Module):
272
272
  forward_kwargs = dict(
273
273
  mask = mask,
274
274
  return_all_codes = return_all_codes,
275
- rand_quantize_dropout_fixed_seed = get_maybe_sync_seed()
275
+ rand_quantize_dropout_fixed_seed = get_maybe_sync_seed(device)
276
276
  )
277
277
 
278
278
  # invoke residual vq on each group
@@ -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)
@@ -296,7 +296,7 @@ class ResidualVQ(Module):
296
296
  # check if seed is manually passed in
297
297
 
298
298
  if not exists(rand_quantize_dropout_fixed_seed):
299
- rand_quantize_dropout_fixed_seed = get_maybe_sync_seed()
299
+ rand_quantize_dropout_fixed_seed = get_maybe_sync_seed(device)
300
300
 
301
301
  rand = random.Random(rand_quantize_dropout_fixed_seed)
302
302
 
@@ -452,7 +452,7 @@ class GroupedResidualVQ(Module):
452
452
  freeze_codebook = False,
453
453
  mask = None,
454
454
  ):
455
- shape, split_dim = x.shape, self.split_dim
455
+ shape, split_dim, device = x.shape, self.split_dim, x.device
456
456
  assert shape[split_dim] == self.dim
457
457
 
458
458
  # split the feature dimension into groups
@@ -468,7 +468,7 @@ class GroupedResidualVQ(Module):
468
468
  sample_codebook_temp = sample_codebook_temp,
469
469
  mask = mask,
470
470
  freeze_codebook = freeze_codebook,
471
- rand_quantize_dropout_fixed_seed = get_maybe_sync_seed()
471
+ rand_quantize_dropout_fixed_seed = get_maybe_sync_seed(device)
472
472
  )
473
473
 
474
474
  # invoke residual vq on each group