Traceback (most recent call last):
File "gen_images.py", line 143, in
generate_images() # pylint: disable=no-value-for-parameter
File "/root/.local/conda/envs/envs/lib/python3.7/site-packages/click/core.py", line 1157, in call
return self.main(args, kwargs)
File "/root/.local/conda/envs/envs/lib/python3.7/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
File "/root/.local/conda/envs/envs/lib/python3.7/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, ctx.params)
File "/root/.local/conda/envs/envs/lib/python3.7/site-packages/click/core.py", line 783, in invoke
return __callback(args, **kwargs)
File "gen_images.py", line 108, in generate_images
G = legacy.load_network_pkl(f)['G_ema'].to(device) # type: ignore
File "/root/diffusion/diffusion-projected-gan/legacy.py", line 26, in load_network_pkl
data = _LegacyUnpickler(f).load()
File "/root/diffusion/diffusion-projected-gan/legacy.py", line 74, in find_class
return super().find_class(module, name)
ModuleNotFoundError: No module named 'builtin',
请问这个问题该如何解决呢?这是对应的代码,
class _LegacyUnpickler(pickle.Unpickler):
def find_class(self, module, name):
if module == 'dnnlib.tflib.network' and name == 'Network':
return _TFNetworkStub
if module == 'torch.storage' and name == '_load_from_bytes':
return lambda b: torch.load(io.BytesIO(b), map_location='cpu')
return super().find_class(module, name)
Traceback (most recent call last): File "gen_images.py", line 143, in
generate_images() # pylint: disable=no-value-for-parameter
File "/root/.local/conda/envs/envs/lib/python3.7/site-packages/click/core.py", line 1157, in call
return self.main(args, kwargs)
File "/root/.local/conda/envs/envs/lib/python3.7/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
File "/root/.local/conda/envs/envs/lib/python3.7/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, ctx.params)
File "/root/.local/conda/envs/envs/lib/python3.7/site-packages/click/core.py", line 783, in invoke
return __callback(args, **kwargs)
File "gen_images.py", line 108, in generate_images
G = legacy.load_network_pkl(f)['G_ema'].to(device) # type: ignore
File "/root/diffusion/diffusion-projected-gan/legacy.py", line 26, in load_network_pkl
data = _LegacyUnpickler(f).load()
File "/root/diffusion/diffusion-projected-gan/legacy.py", line 74, in find_class
return super().find_class(module, name)
ModuleNotFoundError: No module named 'builtin',
请问这个问题该如何解决呢?这是对应的代码, class _LegacyUnpickler(pickle.Unpickler): def find_class(self, module, name): if module == 'dnnlib.tflib.network' and name == 'Network': return _TFNetworkStub if module == 'torch.storage' and name == '_load_from_bytes': return lambda b: torch.load(io.BytesIO(b), map_location='cpu') return super().find_class(module, name)