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

New error #88

Open
DavidRees87 opened this issue Jul 11, 2022 · 2 comments
Open

New error #88

DavidRees87 opened this issue Jul 11, 2022 · 2 comments

Comments

@DavidRees87
Copy link

I'm getting this error message when running in colab, didn't happen before today. Any ideas?

Constructing networks...
Downloading: "https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/tf_efficientnet_lite0-0aa007d2.pth" to /root/.cache/torch/hub/checkpoints/tf_efficientnet_lite0-0aa007d2.pth

AttributeError Traceback (most recent call last)
in ()
21 seed=0,
22 workers=0,
---> 23 restart_every=999999,
24 )

9 frames
in train(**kwargs)
78
79 # Launch.
---> 80 launch_training(c=c, desc=desc, outdir=opts.outdir)

in launch_training(c, desc, outdir, rank)
43 sync_device = torch.device('cuda', rank) if c.num_gpus > 1 else None
44 training_stats.init_multiprocessing(rank=rank, sync_device=sync_device)
---> 45 training_loop.training_loop(rank=rank, **c)

/content/projected_gan/training/training_loop.py in training_loop(run_dir, training_set_kwargs, data_loader_kwargs, G_kwargs, D_kwargs, G_opt_kwargs, D_opt_kwargs, loss_kwargs, metrics, random_seed, num_gpus, rank, batch_size, batch_gpu, ema_kimg, ema_rampup, G_reg_interval, D_reg_interval, total_kimg, kimg_per_tick, image_snapshot_ticks, network_snapshot_ticks, resume_pkl, resume_kimg, cudnn_benchmark, abort_fn, progress_fn, restart_every)
159 common_kwargs = dict(c_dim=training_set.label_dim, img_resolution=training_set.resolution, img_channels=training_set.num_channels)
160 G = dnnlib.util.construct_class_by_name(**G_kwargs, **common_kwargs).train().requires_grad_(False).to(device) # subclass of torch.nn.Module
--> 161 D = dnnlib.util.construct_class_by_name(**D_kwargs, **common_kwargs).train().requires_grad_(False).to(device) # subclass of torch.nn.Module
162 G_ema = copy.deepcopy(G).eval()
163

/content/projected_gan/dnnlib/util.py in construct_class_by_name(class_name, *args, **kwargs)
301 def construct_class_by_name(*args, class_name: str = None, **kwargs) -> Any:
302 """Finds the python class with the given name and constructs it with the given arguments."""
--> 303 return call_func_by_name(*args, func_name=class_name, **kwargs)
304
305

/content/projected_gan/dnnlib/util.py in call_func_by_name(func_name, *args, **kwargs)
296 func_obj = get_obj_by_name(func_name)
297 assert callable(func_obj)
--> 298 return func_obj(*args, **kwargs)
299
300

/content/projected_gan/pg_modules/discriminator.py in init(self, diffaug, interp224, backbone_kwargs, **kwargs)
159 self.diffaug = diffaug
160 self.interp224 = interp224
--> 161 self.feature_network = F_RandomProj(**backbone_kwargs)
162 self.discriminator = MultiScaleD(
163 channels=self.feature_network.CHANNELS,

/content/projected_gan/pg_modules/projector.py in init(self, im_res, cout, expand, proj_type, **kwargs)
106
107 # build pretrained feature network and random decoder (scratch)
--> 108 self.pretrained, self.scratch = _make_projector(im_res=im_res, cout=self.cout, proj_type=self.proj_type, expand=self.expand)
109 self.CHANNELS = self.pretrained.CHANNELS
110 self.RESOLUTIONS = self.pretrained.RESOLUTIONS

/content/projected_gan/pg_modules/projector.py in _make_projector(im_res, cout, proj_type, expand)
62 ### Build pretrained feature network
63 model = timm.create_model('tf_efficientnet_lite0', pretrained=True)
---> 64 pretrained = _make_efficientnet(model)
65
66 # determine resolution of feature maps, this is later used to calculate the number

/content/projected_gan/pg_modules/projector.py in _make_efficientnet(model)
33 def _make_efficientnet(model):
34 pretrained = nn.Module()
---> 35 pretrained.layer0 = nn.Sequential(model.conv_stem, model.bn1, model.act1, *model.blocks[0:2])
36 pretrained.layer1 = nn.Sequential(*model.blocks[2:3])
37 pretrained.layer2 = nn.Sequential(*model.blocks[3:5])

/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py in getattr(self, name)
1184 return modules[name]
1185 raise AttributeError("'{}' object has no attribute '{}'".format(
-> 1186 type(self).name, name))
1187
1188 def setattr(self, name: str, value: Union[Tensor, 'Module']) -> None:

AttributeError: 'EfficientNet' object has no attribute 'act1'

@nom57
Copy link

nom57 commented Jul 11, 2022

#87 (comment)
someone else facing the same issue , they just deleted act1 from projector.py but this is not recommended

Should wait for @xl-sr 's reply on this issue in my opinion, or perhaps @woctezuma 's since he is also very active here.

@netram2
Copy link

netram2 commented Jul 12, 2022

This error occurs because of the python package "timm". It was updated yesterday and that broke it.
Just install version 0.5.4 of timm.

replace
pip install timm
with
pip install timm==0.5.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants