vector-quantize-pytorch 1.16.2__tar.gz → 1.17.0__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.2 → vector_quantize_pytorch-1.17.0}/PKG-INFO +1 -1
- {vector_quantize_pytorch-1.16.2 → vector_quantize_pytorch-1.17.0}/pyproject.toml +1 -1
- {vector_quantize_pytorch-1.16.2 → vector_quantize_pytorch-1.17.0}/vector_quantize_pytorch/finite_scalar_quantization.py +2 -2
- {vector_quantize_pytorch-1.16.2 → vector_quantize_pytorch-1.17.0}/vector_quantize_pytorch/lookup_free_quantization.py +3 -3
- {vector_quantize_pytorch-1.16.2 → vector_quantize_pytorch-1.17.0}/vector_quantize_pytorch/residual_fsq.py +2 -2
- {vector_quantize_pytorch-1.16.2 → vector_quantize_pytorch-1.17.0}/vector_quantize_pytorch/residual_lfq.py +2 -2
- {vector_quantize_pytorch-1.16.2 → vector_quantize_pytorch-1.17.0}/vector_quantize_pytorch/vector_quantize_pytorch.py +3 -3
- {vector_quantize_pytorch-1.16.2 → vector_quantize_pytorch-1.17.0}/.github/workflows/build.yml +0 -0
- {vector_quantize_pytorch-1.16.2 → vector_quantize_pytorch-1.17.0}/.github/workflows/python-publish.yml +0 -0
- {vector_quantize_pytorch-1.16.2 → vector_quantize_pytorch-1.17.0}/.github/workflows/test.yml +0 -0
- {vector_quantize_pytorch-1.16.2 → vector_quantize_pytorch-1.17.0}/.gitignore +0 -0
- {vector_quantize_pytorch-1.16.2 → vector_quantize_pytorch-1.17.0}/LICENSE +0 -0
- {vector_quantize_pytorch-1.16.2 → vector_quantize_pytorch-1.17.0}/README.md +0 -0
- {vector_quantize_pytorch-1.16.2 → vector_quantize_pytorch-1.17.0}/examples/autoencoder.py +0 -0
- {vector_quantize_pytorch-1.16.2 → vector_quantize_pytorch-1.17.0}/examples/autoencoder_fsq.py +0 -0
- {vector_quantize_pytorch-1.16.2 → vector_quantize_pytorch-1.17.0}/examples/autoencoder_lfq.py +0 -0
- {vector_quantize_pytorch-1.16.2 → vector_quantize_pytorch-1.17.0}/images/fsq.png +0 -0
- {vector_quantize_pytorch-1.16.2 → vector_quantize_pytorch-1.17.0}/images/lfq.png +0 -0
- {vector_quantize_pytorch-1.16.2 → vector_quantize_pytorch-1.17.0}/images/vq.png +0 -0
- {vector_quantize_pytorch-1.16.2 → vector_quantize_pytorch-1.17.0}/ruff.toml +0 -0
- {vector_quantize_pytorch-1.16.2 → vector_quantize_pytorch-1.17.0}/tests/test_latent_quantization.py +0 -0
- {vector_quantize_pytorch-1.16.2 → vector_quantize_pytorch-1.17.0}/tests/test_readme.py +0 -0
- {vector_quantize_pytorch-1.16.2 → vector_quantize_pytorch-1.17.0}/vector_quantize_pytorch/__init__.py +0 -0
- {vector_quantize_pytorch-1.16.2 → vector_quantize_pytorch-1.17.0}/vector_quantize_pytorch/latent_quantization.py +0 -0
- {vector_quantize_pytorch-1.16.2 → vector_quantize_pytorch-1.17.0}/vector_quantize_pytorch/random_projection_quantizer.py +0 -0
- {vector_quantize_pytorch-1.16.2 → vector_quantize_pytorch-1.17.0}/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.
|
|
3
|
+
Version: 1.17.0
|
|
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
|
|
@@ -12,7 +12,7 @@ import torch
|
|
|
12
12
|
import torch.nn as nn
|
|
13
13
|
from torch.nn import Module
|
|
14
14
|
from torch import Tensor, int32
|
|
15
|
-
from torch.
|
|
15
|
+
from torch.amp import autocast
|
|
16
16
|
|
|
17
17
|
from einops import rearrange, pack, unpack
|
|
18
18
|
|
|
@@ -159,7 +159,7 @@ class FSQ(Module):
|
|
|
159
159
|
|
|
160
160
|
return codes
|
|
161
161
|
|
|
162
|
-
@autocast(enabled = False)
|
|
162
|
+
@autocast('cuda', enabled = False)
|
|
163
163
|
def forward(self, z):
|
|
164
164
|
"""
|
|
165
165
|
einstein notation
|
|
@@ -16,7 +16,7 @@ import torch
|
|
|
16
16
|
from torch import nn, einsum
|
|
17
17
|
import torch.nn.functional as F
|
|
18
18
|
from torch.nn import Module
|
|
19
|
-
from torch.
|
|
19
|
+
from torch.amp import autocast
|
|
20
20
|
|
|
21
21
|
from einops import rearrange, reduce, pack, unpack
|
|
22
22
|
|
|
@@ -36,7 +36,7 @@ def maybe_distributed_mean(t):
|
|
|
36
36
|
if not is_distributed():
|
|
37
37
|
return t
|
|
38
38
|
|
|
39
|
-
dist.all_reduce(t)
|
|
39
|
+
dist.nn.all_reduce(t)
|
|
40
40
|
t = t / dist.get_world_size()
|
|
41
41
|
return t
|
|
42
42
|
|
|
@@ -293,7 +293,7 @@ class LFQ(Module):
|
|
|
293
293
|
|
|
294
294
|
force_f32 = self.force_quantization_f32
|
|
295
295
|
|
|
296
|
-
quantization_context = partial(autocast, enabled = False) if force_f32 else nullcontext
|
|
296
|
+
quantization_context = partial(autocast, 'cuda', enabled = False) if force_f32 else nullcontext
|
|
297
297
|
|
|
298
298
|
with quantization_context():
|
|
299
299
|
|
|
@@ -8,7 +8,7 @@ import torch
|
|
|
8
8
|
from torch import nn
|
|
9
9
|
from torch.nn import Module, ModuleList
|
|
10
10
|
import torch.nn.functional as F
|
|
11
|
-
from torch.
|
|
11
|
+
from torch.amp import autocast
|
|
12
12
|
|
|
13
13
|
from vector_quantize_pytorch.finite_scalar_quantization import FSQ
|
|
14
14
|
|
|
@@ -167,7 +167,7 @@ class ResidualFSQ(Module):
|
|
|
167
167
|
|
|
168
168
|
# go through the layers
|
|
169
169
|
|
|
170
|
-
with autocast(enabled = False):
|
|
170
|
+
with autocast('cuda', enabled = False):
|
|
171
171
|
for quantizer_index, (layer, scale) in enumerate(zip(self.layers, self.scales)):
|
|
172
172
|
|
|
173
173
|
if should_quantize_dropout and quantizer_index > rand_quantize_dropout_index:
|
|
@@ -6,7 +6,7 @@ import torch
|
|
|
6
6
|
from torch import nn
|
|
7
7
|
from torch.nn import Module, ModuleList
|
|
8
8
|
import torch.nn.functional as F
|
|
9
|
-
from torch.
|
|
9
|
+
from torch.amp import autocast
|
|
10
10
|
|
|
11
11
|
from vector_quantize_pytorch.lookup_free_quantization import LFQ
|
|
12
12
|
|
|
@@ -156,7 +156,7 @@ class ResidualLFQ(Module):
|
|
|
156
156
|
|
|
157
157
|
# go through the layers
|
|
158
158
|
|
|
159
|
-
with autocast(enabled = False):
|
|
159
|
+
with autocast('cuda', enabled = False):
|
|
160
160
|
for quantizer_index, layer in enumerate(self.layers):
|
|
161
161
|
|
|
162
162
|
if should_quantize_dropout and quantizer_index > rand_quantize_dropout_index:
|
|
@@ -9,7 +9,7 @@ from torch import nn, einsum, Tensor
|
|
|
9
9
|
import torch.nn.functional as F
|
|
10
10
|
import torch.distributed as distributed
|
|
11
11
|
from torch.optim import Optimizer
|
|
12
|
-
from torch.
|
|
12
|
+
from torch.amp import autocast
|
|
13
13
|
|
|
14
14
|
import einx
|
|
15
15
|
from einops import rearrange, repeat, reduce, pack, unpack
|
|
@@ -458,7 +458,7 @@ class EuclideanCodebook(Module):
|
|
|
458
458
|
batch_samples = rearrange(batch_samples, 'h ... d -> h (...) d')
|
|
459
459
|
self.replace(batch_samples, batch_mask = expired_codes)
|
|
460
460
|
|
|
461
|
-
@autocast(enabled = False)
|
|
461
|
+
@autocast('cuda', enabled = False)
|
|
462
462
|
def forward(
|
|
463
463
|
self,
|
|
464
464
|
x,
|
|
@@ -671,7 +671,7 @@ class CosineSimCodebook(Module):
|
|
|
671
671
|
batch_samples = rearrange(batch_samples, 'h ... d -> h (...) d')
|
|
672
672
|
self.replace(batch_samples, batch_mask = expired_codes)
|
|
673
673
|
|
|
674
|
-
@autocast(enabled = False)
|
|
674
|
+
@autocast('cuda', enabled = False)
|
|
675
675
|
def forward(
|
|
676
676
|
self,
|
|
677
677
|
x,
|
{vector_quantize_pytorch-1.16.2 → vector_quantize_pytorch-1.17.0}/.github/workflows/build.yml
RENAMED
|
File without changes
|
|
File without changes
|
{vector_quantize_pytorch-1.16.2 → vector_quantize_pytorch-1.17.0}/.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.2 → vector_quantize_pytorch-1.17.0}/examples/autoencoder_fsq.py
RENAMED
|
File without changes
|
{vector_quantize_pytorch-1.16.2 → vector_quantize_pytorch-1.17.0}/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.2 → vector_quantize_pytorch-1.17.0}/tests/test_latent_quantization.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|