The pretrianed model you provieded in last issue can't be load
Opened this issue · 0 comments
Thanks for your excellent work!But I got problem in weight loading
The pretrained model and config form#6
This is my config yaml
overall:
seed: 0
device: 'cuda'
test: false
test_dir: ''
gt_dir: ''
output_dir: './temp'
resume: 0
data:
data_root_dir: '/opt/data/private/wzh/result/isecret/'
dataset: 'eyeq'
size: 512
crop_size: -1
dist:
gpu: '0'
dist_backend: 'nccl'
init_method: 'tcp://localhost:10098'
num_shards: 1
shard_id: 0
num_worker: 0
batch_size: 2
experiment:
name: 'debug'
experiment_root_dir: '/opt/data/private/wzh/result/isecret/'
train:
default: false
epochs: 200
len: 0
save_freq: 10
sample_freq: 500
no_val: false
metric: 'psnr'
optim: 'adam_belief'
beta1: 0.5
beta2: 0.999
weight_decay: 0.0001
lr: 0.0001
scheduler: 'cosine'
nce_layers: '1,5,9,12,16,18,20'
nce_T: 0.07
n_patches: 256
lambda_gan: 1.0
lambda_icc: 0.0
lambda_idt: 0.0
lambda_simsiam: 0.0
lambda_ssim: 0.0
lambda_idt_ssim: 0.0
lambda_psnr: 0.0
lambda_rec: 1.0
lambda_is: 0.0
model:
model_name: 'i-secret'
model_path: '/opt/data/private/wzh/result/isecret/eyeq/512/isecret1/isecret.pt'
image_size: 512
image_mean: 0.5
image_std: 0.5
n_blocks: 9
n_downs: 2
n_filters: 64
input_nc: 3
output_nc: 3
use_dropout: False
generator: resnet
padding: reflect
norm: in
This is the error message
Traceback (most recent call last): File "main.py", line 29, in <module> launch_job(args, test_func) File "/opt/data/private/wzh/workspace/isecret/isecret/utils/launch.py", line 87, in launch_job func(args) File "/opt/data/private/wzh/workspace/isecret/test.py", line 43, in test_func model = TestModel(args) File "/root/anaconda3/envs/isecret/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/opt/data/private/wzh/workspace/isecret/isecret/model/test_model.py", line 24, in __init__ MyModel.__init__(self, args) File "/opt/data/private/wzh/workspace/isecret/isecret/model/common.py", line 37, in __init__ self.build_model() File "/opt/data/private/wzh/workspace/isecret/isecret/model/test_model.py", line 48, in build_model self.load('last') File "/opt/data/private/wzh/workspace/isecret/isecret/model/common.py", line 350, in load model.load_state_dict(state['weights']) File "/root/anaconda3/envs/isecret/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1223, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for ResGenerator: Missing key(s) in state_dict: "model.1.weight", "model.1.bias", "model.5.weight", "model.5.bias", "model.9.weight", "model.9.bias", "model.12.conv_block.1.weight", "model.12.conv_block.1.bias", "model.12.conv_block.5.weight", "model.12.conv_block.5.bias", "model.13.conv_block.1.weight", "model.13.conv_block.1.bias", "model.13.conv_block.5.weight", "model.13.conv_block.5.bias", "model.14.conv_block.1.weight", "model.14.conv_block.1.bias", "model.14.conv_block.5.weight", "model.14.conv_block.5.bias", "model.15.conv_block.1.weight", "model.15.conv_block.1.bias", "model.15.conv_block.5.weight", "model.15.conv_block.5.bias", "model.16.conv_block.1.weight", "model.16.conv_block.1.bias", "model.16.conv_block.5.weight", "model.16.conv_block.5.bias", "model.17.conv_block.1.weight", "model.17.conv_block.1.bias", "model.17.conv_block.5.weight", "model.17.conv_block.5.bias", "model.18.conv_block.1.weight", "model.18.conv_block.1.bias", "model.18.conv_block.5.weight", "model.18.conv_block.5.bias", "model.19.conv_block.1.weight", "model.19.conv_block.1.bias", "model.19.conv_block.5.weight", "model.19.conv_block.5.bias", "model.20.conv_block.1.weight", "model.20.conv_block.1.bias", "model.20.conv_block.5.weight", "model.20.conv_block.5.bias", "model.21.weight", "model.21.bias", "model.24.weight", "model.24.bias", "model.28.weight", "model.28.bias". Unexpected key(s) in state_dict: "head.1.weight", "head.1.bias", "downs.1.weight", "downs.1.bias", "downs.5.weight", "downs.5.bias", "neck.0.conv_block.1.weight", "neck.0.conv_block.1.bias", "neck.0.conv_block.5.weight", "neck.0.conv_block.5.bias", "neck.1.conv_block.1.weight", "neck.1.conv_block.1.bias", "neck.1.conv_block.5.weight", "neck.1.conv_block.5.bias", "neck.2.conv_block.1.weight", "neck.2.conv_block.1.bias", "neck.2.conv_block.5.weight", "neck.2.conv_block.5.bias", "neck.3.conv_block.1.weight", "neck.3.conv_block.1.bias", "neck.3.conv_block.5.weight", "neck.3.conv_block.5.bias", "neck.4.conv_block.1.weight", "neck.4.conv_block.1.bias", "neck.4.conv_block.5.weight", "neck.4.conv_block.5.bias", "neck.5.conv_block.1.weight", "neck.5.conv_block.1.bias", "neck.5.conv_block.5.weight", "neck.5.conv_block.5.bias", "neck.6.conv_block.1.weight", "neck.6.conv_block.1.bias", "neck.6.conv_block.5.weight", "neck.6.conv_block.5.bias", "neck.7.conv_block.1.weight", "neck.7.conv_block.1.bias", "neck.7.conv_block.5.weight", "neck.7.conv_block.5.bias", "neck.8.conv_block.1.weight", "neck.8.conv_block.1.bias", "neck.8.conv_block.5.weight", "neck.8.conv_block.5.bias", "ups.0.weight", "ups.0.bias", "ups.3.weight", "ups.3.bias", "ups.7.weight", "ups.7.bias", "importance_ups.0.weight", "importance_ups.0.bias", "importance_ups.3.weight", "importance_ups.3.bias", "importance_ups.7.weight", "importance_ups.7.bias".