Skip to content
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

Update projected_model.py #310

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
4 changes: 3 additions & 1 deletion models/projected_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,16 @@ def initialize(self, opt):
self.netArc = self.netArc.cuda()
self.netArc.eval()
self.netArc.requires_grad_(False)

if not self.isTrain:
pretrained_path = opt.checkpoints_dir
self.load_network(self.netG, 'G', opt.which_epoch, pretrained_path)
return

self.netD = ProjectedDiscriminator(diffaug=False, interp224=False, **{})
# self.netD.feature_network.requires_grad_(False)
self.netD.cuda()


if self.isTrain:
# define loss functions
self.criterionFeat = nn.L1Loss()
Expand All @@ -83,6 +84,7 @@ def initialize(self, opt):
self.load_network(self.netD, 'D', opt.which_epoch, pretrained_path)
self.load_optim(self.optimizer_G, 'G', opt.which_epoch, pretrained_path)
self.load_optim(self.optimizer_D, 'D', opt.which_epoch, pretrained_path)

torch.cuda.empty_cache()

def cosin_metric(self, x1, x2):
Expand Down