Skip to content

Commit

Permalink
fix VQ for fp16
Browse files Browse the repository at this point in the history
  • Loading branch information
Vermeille committed Oct 4, 2022
1 parent 5fafd44 commit e98572b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion torchelie/nn/vq.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def resample_dead(self, x):
x_flat = x.view(-1, x.shape[-1])
emb_weight = self.embedding.weight.data
emb_weight[dead[:len(x_flat)]] = x_flat[torch.randperm(
len(x_flat))[:len(dead)]]
len(x_flat))[:len(dead)]].to(emb_weight.dtype)
self.age[dead[:len(x_flat)]] = 0

if torch.distributed.is_initialized():
Expand Down

0 comments on commit e98572b

Please sign in to comment.