File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 1
1
[project ]
2
2
name = " vector-quantize-pytorch"
3
- version = " 1.23.1 "
3
+ version = " 1.23.2 "
4
4
description = " Vector Quantization - Pytorch"
5
5
authors = [
6
6
{
name =
" Phil Wang" ,
email =
" [email protected] " }
Original file line number Diff line number Diff line change @@ -1063,6 +1063,19 @@ def update_in_place_optimizer(self):
1063
1063
if not exists (self .in_place_codebook_optimizer ):
1064
1064
return
1065
1065
1066
+ # handle ddp, thanks to @gdoras
1067
+
1068
+ if self ._codebook .use_ddp :
1069
+
1070
+ for param in self ._codebook .parameters ():
1071
+ if not exists (param .grad ):
1072
+ continue
1073
+
1074
+ distributed .all_reduce (param .grad )
1075
+ param .grad /= distributed .get_world_size ()
1076
+
1077
+ # optimizer step
1078
+
1066
1079
self .in_place_codebook_optimizer .step ()
1067
1080
self .in_place_codebook_optimizer .zero_grad ()
1068
1081
You can’t perform that action at this time.
0 commit comments