Skip to content

Commit 9d2594b

Browse files
committed
1 parent 8bb740e commit 9d2594b

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "vector-quantize-pytorch"
3-
version = "1.22.12"
3+
version = "1.22.15"
44
description = "Vector Quantization - Pytorch"
55
authors = [
66
{ name = "Phil Wang", email = "lucidrains@gmail.com" }

vector_quantize_pytorch/residual_fsq.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def forward(
190190

191191
all_indices = []
192192

193-
should_quantize_dropout = self.training and self.quantize_dropout
193+
should_quantize_dropout = self.training and self.quantize_dropout and torch.is_grad_enabled()
194194

195195
# sample a layer index at which to dropout further residual quantization
196196
# also prepare null indices

vector_quantize_pytorch/residual_lfq.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def forward(
152152
all_losses = []
153153
all_indices = []
154154

155-
should_quantize_dropout = self.training and self.quantize_dropout
155+
should_quantize_dropout = self.training and self.quantize_dropout and torch.is_grad_enabled()
156156

157157
# sample a layer index at which to dropout further residual quantization
158158
# also prepare null indices and loss

0 commit comments

Comments
 (0)