Skip to content

Commit

Permalink
Merge pull request #59 from YotamNitzan/clip_no_grad
Browse files Browse the repository at this point in the history
Turn off gradients to CLIP's weights
  • Loading branch information
rinongal authored Aug 30, 2022
2 parents 2690617 + a81bf92 commit dc8406a
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 dc8406a

Please sign in to comment.