Skip to content

Commit

Permalink
Turn off gradients to CLIP's weights
Browse files Browse the repository at this point in the history
  • Loading branch information
Yotam Nitzan committed Jul 28, 2022
1 parent 775b8d1 commit a81bf92
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ZSSGAN/criteria/clip_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ def __init__(self, device, lambda_direction=1., lambda_patch=0., lambda_global=0
preprocess_cnn.transforms[:2] + # to match CLIP input scale assumptions
preprocess_cnn.transforms[4:]) # + skip convert PIL to tensor

self.model.requires_grad_(False)
self.model_cnn.requires_grad_(False)

self.texture_loss = torch.nn.MSELoss()

def tokenize(self, strings: list):
Expand Down

0 comments on commit a81bf92

Please sign in to comment.