Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

cannot deepcopy this pattern object #17

Closed
Mushahid2521 opened this issue Feb 10, 2020 · 7 comments
Closed

cannot deepcopy this pattern object #17

Mushahid2521 opened this issue Feb 10, 2020 · 7 comments

Comments

@Mushahid2521
Copy link

I tried to run the project on Google Colab. I have imported and downloaded everything I guess so. But when I run the Inference script it gives the following error.
y = copier(memo) TypeError: cannot deepcopy this pattern object
If anyone please help.

@andrewjong
Copy link
Owner

Can you post more information? I don't recognize this line from my code, perhaps it's from some library that I used.

@Mushahid2521
Copy link
Author

Hello.
The error is showing in the deepcopy() function from copy module in python.
File "/content/SwapNet/options/base_options.py", line 264, in copy return copy.deepcopy(self)

@raghubetageri
Copy link

@andrewjong (raghu) dioxe@dioxe-Inspiron-3542:~/project/SwapNet-master$ python inference.py --checkpoint checkpoints/deep_fashion \

--dataroot data/deep_fashion
--shuffle_data True
model None
dataset None
=====OPTIONS======
config_file : None
comments :
verbose : False
display_winsize : 256
checkpoints_dir : ./checkpoints
load_epoch : latest
dataset : None
dataset_mode : image
cloth_representation : labels
body_representation : rgb
cloth_channels : 19
body_channels : 12
texture_channels : 3
pad : False
load_size : 128
crop_size : 128
crop_bounds : None
max_dataset_size : 50
batch_size : 8
shuffle_data : True
num_workers : 4
gpu_id : 0
no_confirm : False
interval : 1
warp_checkpoint : None
texture_checkpoint : None
checkpoint : checkpoints/deep_fashion
body_dir : None
cloth_dir : None
texture_dir : None
results_dir : results
skip_intermediates : False
dataroot : data/deep_fashion
model : None
name :
is_train : False
==================
The experiment directory 'results' already exists.
Here are its contents:
['warp', 'args.json']

Existing data will be overwritten!
Are you sure you want to continue? (y/N): y

Set warp_checkpoint to checkpoints/deep_fashion/warp/latest_net_generator.pth
Set texture_checkpoint to checkpoints/deep_fashion/texture/latest_net_generator.pth
Running warp inference...
Rebuilding warp from checkpoints/deep_fashion/warp/latest_net_generator.pth
Traceback (most recent call last):
File "inference.py", line 227, in
_run_warp()
File "inference.py", line 147, in _run_warp
opt.warp_checkpoint, cloth_dir=opt.cloth_dir, body_dir=opt.body_dir
File "inference.py", line 58, in _rebuild_from_checkpoint
loaded_opt = _copy_and_load_config(checkpoint_dir).opt
File "inference.py", line 89, in _copy_and_load_config
return config.copy().load(os.path.join(directory, "args.json"))
File "/home/dioxe/project/SwapNet-master/options/base_options.py", line 264, in copy
return copy.deepcopy(self)
File "/home/dioxe/anaconda3/envs/raghu/lib/python3.6/copy.py", line 180, in deepcopy
y = _reconstruct(x, memo, *rv)
File "/home/dioxe/anaconda3/envs/raghu/lib/python3.6/copy.py", line 280, in _reconstruct
state = deepcopy(state, memo)
File "/home/dioxe/anaconda3/envs/raghu/lib/python3.6/copy.py", line 150, in deepcopy
y = copier(x, memo)
File "/home/dioxe/anaconda3/envs/raghu/lib/python3.6/copy.py", line 240, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/home/dioxe/anaconda3/envs/raghu/lib/python3.6/copy.py", line 180, in deepcopy
y = _reconstruct(x, memo, *rv)
File "/home/dioxe/anaconda3/envs/raghu/lib/python3.6/copy.py", line 280, in _reconstruct
state = deepcopy(state, memo)
File "/home/dioxe/anaconda3/envs/raghu/lib/python3.6/copy.py", line 150, in deepcopy
y = copier(x, memo)
File "/home/dioxe/anaconda3/envs/raghu/lib/python3.6/copy.py", line 240, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/home/dioxe/anaconda3/envs/raghu/lib/python3.6/copy.py", line 150, in deepcopy
y = copier(x, memo)
File "/home/dioxe/anaconda3/envs/raghu/lib/python3.6/copy.py", line 215, in _deepcopy_list
append(deepcopy(a, memo))
File "/home/dioxe/anaconda3/envs/raghu/lib/python3.6/copy.py", line 180, in deepcopy
y = _reconstruct(x, memo, *rv)
File "/home/dioxe/anaconda3/envs/raghu/lib/python3.6/copy.py", line 280, in _reconstruct
state = deepcopy(state, memo)
File "/home/dioxe/anaconda3/envs/raghu/lib/python3.6/copy.py", line 150, in deepcopy
y = copier(x, memo)
File "/home/dioxe/anaconda3/envs/raghu/lib/python3.6/copy.py", line 240, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/home/dioxe/anaconda3/envs/raghu/lib/python3.6/copy.py", line 180, in deepcopy
y = _reconstruct(x, memo, *rv)
File "/home/dioxe/anaconda3/envs/raghu/lib/python3.6/copy.py", line 280, in _reconstruct
state = deepcopy(state, memo)
File "/home/dioxe/anaconda3/envs/raghu/lib/python3.6/copy.py", line 150, in deepcopy
y = copier(x, memo)
File "/home/dioxe/anaconda3/envs/raghu/lib/python3.6/copy.py", line 240, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/home/dioxe/anaconda3/envs/raghu/lib/python3.6/copy.py", line 161, in deepcopy
y = copier(memo)
TypeError: cannot deepcopy this pattern object

@andrewjong
Copy link
Owner

Thanks for the detailed description. I'll take a look.

@Devetec
Copy link

Devetec commented Feb 25, 2020

Have the same issue! Please fix!

@andrewjong
Copy link
Owner

andrewjong commented Feb 27, 2020

Hi all,
I have pushed a fix to bugfix/17-inference. Can you try it and let me know if it works for you, please?

Interestingly I am unable to reproduce the bug on my machine on the master branch. The bugfix I pushed theoretically should avoid this issue, as it's no longer copying the Options class, though please let me know what happens.

@andrewjong
Copy link
Owner

Seems like this was fixed in the recent merge. Please reopen if you encounter the same problem.

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

No branches or pull requests

4 participants