Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何进行测试呢? #5

Open
xiaoerjason opened this issue Dec 9, 2022 · 3 comments
Open

如何进行测试呢? #5

xiaoerjason opened this issue Dec 9, 2022 · 3 comments

Comments

@xiaoerjason
Copy link

当我使用预训练模型进行推理的时候发生了错误:
torch.nn.modules.module.ModuleAttributeError: 'Sequential' object has no attribute 'model'

@xiaoerjason
Copy link
Author

----------------- Options ---------------
aspect_ratio: 1.0
batch_size: 2
checkpoints_dir: ./checkpoints
crop_size: 256
dataroot: ./test_img [default: ./datasets/BCI]
dataset_mode: aligned
direction: AtoB
display_winsize: 256
epoch: latest
eval: False
gpu_ids: 0
init_gain: 0.02
init_type: normal
input_nc: 3
isTrain: False [default: None]
load_iter: 0 [default: 0]
load_size: 320
max_dataset_size: inf
model: pix2pix
n_layers_D: 3
name: pyramidpix2pix
ndf: 64
netD: basic
netG: resnet_9blocks
ngf: 64
no_dropout: False
no_flip: False
norm: batch
num_test: 1000
num_threads: 4
output_nc: 3
pattern: L1_L2_L3_L4
phase: test
preprocess: scale_width_and_midcrop
results_dir: ./results/
serial_batches: False
suffix:
verbose: False
----------------- End -------------------

@SantJay
Copy link
Collaborator

SantJay commented Dec 13, 2022

这可能是pytorch版本和模型不匹配造成的。我们使用的pytorch版本为1.9.0,您可以使用和我们一样的版本测试一下。

@arsham-khafan
Copy link

@xiaoerjason , @SantJay hello I have the exact same problem I am using PyTorch 1.9.0 but the error is exactly the same!
I have tried everything but I can't generate images using pre-trained model here is the exact issue:
----------------- Options ---------------
aspect_ratio: 1.0
batch_size: 2
checkpoints_dir: ./checkpoints
crop_size: 256
dataroot: ./datasets/BCI
dataset_mode: aligned
direction: AtoB
display_winsize: 256
epoch: latest
eval: False
gpu_ids: -1
init_gain: 0.02
init_type: normal
input_nc: 3
isTrain: False [default: None]
load_iter: 0 [default: 0]
load_size: 320
max_dataset_size: inf
model: pix2pix
n_layers_D: 3
name: pyramidpix2pix
ndf: 64
netD: basic
netG: resnet_9blocks
ngf: 64
no_dropout: False
no_flip: False
norm: batch
num_test: 1000
num_threads: 4
output_nc: 3
pattern: L1_L2_L3_L4
phase: test
preprocess: scale_width_and_midcrop
results_dir: ./results/
serial_batches: False
suffix:
verbose: False
----------------- End -------------------
dataset [AlignedDataset] was created
initialize network with normal
model [Pix2PixModel] was created
loading the model from ./checkpoints\pyramidpix2pix\latest_net_G.pth
Traceback (most recent call last):
File "test.py", line 47, in
model.setup(opt) # regular setup: load and print networks; create schedulers
File .\base_model.py", line 88, in setup
self.load_networks(load_suffix)
File ".\base_model.py", line 198, in load_networks
self.__patch_instance_norm_state_dict(state_dict, net, key.split('.'))
File ".\base_model.py", line 174, in __patch_instance_norm_state_dict
self.__patch_instance_norm_state_dict(state_dict, getattr(module, key), keys, i + 1)
File ".\base_model.py", line 174, in __patch_instance_norm_state_dict
self.__patch_instance_norm_state_dict(state_dict, getattr(module, key), keys, i + 1)
File ".\torch\nn\modules\module.py", line 1130, in getattr
raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'Sequential' object has no attribute 'model'

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

No branches or pull requests

3 participants