Skip to content

assert freeze_codebook if self.freeze_codebook in init #209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions vector_quantize_pytorch/vector_quantize_pytorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,8 @@ def __init__(

self.eps = eps

self.freeze_codebook = freeze_codebook

self.has_commitment_loss = commitment_weight > 0.
self.commitment_weight = commitment_weight
self.commitment_use_cross_entropy_loss = commitment_use_cross_entropy_loss # whether to use cross entropy loss to codebook as commitment loss
Expand Down Expand Up @@ -1048,6 +1050,9 @@ def forward(
):
orig_input, input_requires_grad = x, x.requires_grad

if self.freeze_codebook:
assert freeze_codebook

# handle masking, either passed in as `mask` or `lens`

assert not (exists(mask) and exists(lens))
Expand Down
Loading