Skip to content

Commit 1700de8

Browse files
committed
do not break previous models
1 parent 0e90fad commit 1700de8

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
name = 'stylegan2_pytorch',
55
packages = find_packages(),
66
scripts=['bin/stylegan2_pytorch'],
7-
version = '0.17.12',
7+
version = '0.17.13',
88
license='GPLv3+',
99
description = 'StyleGan2 in Pytorch',
1010
author = 'Phil Wang',

stylegan2_pytorch/stylegan2_pytorch.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -977,6 +977,11 @@ def load(self, num = -1):
977977
self.steps = name * self.save_every
978978

979979
load_data = torch.load(self.model_name(name))
980+
981+
# make backwards compatible
982+
if 'GAN' not in load_data:
983+
load_data = {'GAN': load_data}
984+
980985
self.GAN.load_state_dict(load_data['GAN'])
981986

982987
if self.GAN.fp16 and 'amp' in load_data:

0 commit comments

Comments
 (0)