Open 17328-wu opened 2 years ago
After I solve the above problems,the following error occurred:
loading the model from ./checkpoints\iid_hlgvit_crs_gd4_cfs_v3_ohaze\20_net_G.pth
Traceback (most recent call last):
File "test.py", line 28, in
This is very confusing to me.Do you know the cause of the error? Looking forward to your reply,thanks!
ModuleNotFoundError: No module named 'ECLoss'
How were you able to resolve this error??
ModuleNotFoundError: No module named 'ECLoss'
How were you able to resolve this error??
I found it on the https://github.com/HUSTSYJ/DA_dahazing
How were you able to resolve this error?? When I run the test.py file following the instructions given by the author, I get some errors:
AttributeError: 'ipt' object has no attribute 'localvit_decoder_03r'
Do you have similar cases?
Do you have similar cases?
Yeah I am facing the same issue. I checked the files and found that the main problem lies in the following file model/base_model.py
. I think, the following function must be edited in this file.
def load_networks(self, which_epoch):
for name in self.model_names:
if isinstance(name, str):
load_filename = '%s_net_%s.pth' % (which_epoch, name)
load_path = os.path.join(self.save_dir, load_filename)
net = getattr(self, 'net' + name)
if isinstance(net, torch.nn.DataParallel):
net = net.module
#net = torch.nn.DataParallel(net, device_ids=range(torch.cuda.device_count()))
print('loading the model from %s' % load_path)
# if you are using PyTorch newer than 0.4 (e.g., built from
# GitHub source), you can remove str() on self.device
state_dict = torch.load(load_path, map_location=str(self.device))
# patch InstanceNorm checkpoints prior to 0.4
for key in list(state_dict.keys()): # need to copy keys here because we mutate in loop
self.__patch_instance_norm_state_dict(state_dict, net, key.split('.'))
net.load_state_dict(state_dict)
In the above function they are using net = getattr(self, 'net'+name)
to get the model and state_dict = ....
to get the state_dicts. I printed both and noticed that localvit_decoder_03r
is present in state_dict but not in net. And this is the reason for that error.
This is what I found. If you are able to resolve this then please share the solution here.
Thanks for you reply. Yes, I found that too. But don't know how to solve the problem.
Thanks for you reply. Yes, I found that too. But don't know how to solve the problem.
On the one hand, you need to adjust the selected model when loading the model parameters, for example, using dec-vit model, and then loading the corresponding parameters. This step needs to adjust the code to load the model as needed. In addition, some parameters in base_option.py also need to be adjusted by yourself.
Thanks for your sharing! When I execute the script test.py ,the following error occurred: ModuleNotFoundError: No module named 'ECLoss'
However, I can't find the package using the pip install command and on the website How can I solve this problem? Looking forward to your reply, thanks !