Comments (6)
I've pushed a new version. You can directly pull the new version to avoid this problem.
from enlightengan.
Fix :
In models/base_model.py replace the load_network with the following:
def load_network(self, network, network_label, epoch_label):
save_filename = '%s_net_%s.pth' % (epoch_label, network_label)
save_path = os.path.join(self.save_dir, save_filename)
state_dict = torch.load(save_path)
new_state_dict = OrderedDict()
for k, v in state_dict.items():
name = k[7:] # remove module.
new_state_dict[name] = v
network.load_state_dict(new_state_dict)
from enlightengan.
您好,在经过上述修改后,
并将 new_state_dict = OrderedDict() 修改为 new_state_dict = collections.OrderedDict() 后,
出现KeyError: 'unexpected key "conv10.bias" in state_dict',该如何解决?
from enlightengan.
Is your python 3.5, pytorch 0.3.1? And are you trying to run via CPU or GPU?
from enlightengan.
@Dear-Mr @SreeHarshaNelaturu
This problem is about torch.nn.DataParallel()
. Normally DataParallel()
will cover the original model, which means you can only use model.module
to access the original model. And also, if you directly save the model covered by DataParallel, the key of saved model will be module.conv.weight
instead of conv.weight
.
You can simply use DataParallel to cover the model before you load the pre-trained model to solve this problem.
Eg.
model = ResNet()
parallel_model = torch.nn.DataParallel(model)
print(parallel_model.module)
# Here parallel_model.module is equal to model
from enlightengan.
Is your python 3.5, pytorch 0.3.1? And are you trying to run via CPU or GPU?
Thanks for your reply.
My workspace is python 3.5, PyTorch 0.3.1, torchvision 0.2.0. And i tried to run via GPU.
from enlightengan.
Related Issues (20)
- UserWarning: nn.functional.upsample is deprecated. Use nn.functional.interpolate instead.
- multiprocessing error HOT 2
- Could it be posible create low-light image? HOT 1
- 请问有关于纯粹的EnlightenGAN这篇论文的代码吗?不包含其他对比算法的。 HOT 1
- train issues HOT 1
- where to place the final_dataset folder? HOT 1
- 请问在哪里修改生成图像的名称 HOT 1
- error HOT 1
- TypeError: load() missing 1 required positional argument: 'Loader' HOT 1
- The difference between D_A and D_P loss
- 训练时判别器网络报错
- 下载模型 HOT 1
- Pre-Processing for Improving Classification
- Predict the .mp4 HOT 1
- 预测时只能调用一张显卡
- Questions about training data sets HOT 2
- 训练效果
- can i use it to my own high-resolution images?
- 亮度提升
- What is D_P, D_A, vgg and G_A in loss graph?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from enlightengan.