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

test_before_push is a great rapid test file, but seems outdated? #88

Open
NataliaDiaz opened this issue Jul 1, 2020 · 3 comments
Open

Comments

@NataliaDiaz
Copy link

https://github.com/junyanz/BicycleGAN/blob/master/scripts/test_before_push.py

BicycleGAN$ python ./scripts/test_before_push.pybash

./datasets/download_cyclegan_dataset.sh mini_pix2pix bash: ./datasets/download_cyclegan_dataset.sh: No such file or directory

@junyanz
Copy link
Owner

junyanz commented Jul 2, 2020

I updated it with 7ef3acd. Could you give a try?

@NataliaDiaz
Copy link
Author

NataliaDiaz commented Jul 6, 2020

thanks! it works now. However, if I adapt the same template to run it over another dataset, e.g. facades, as follows:

if not os.path.exists('./datasets/facades'):
        run('bash ./datasets/download_dataset.sh facades')
    
    # template train/test for Facades:
    run('python train.py --model facades --name temp_facades --dataroot ./datasets/facades --niter 1 --niter_decay 0 --save_latest_freq 10 --display_id -1')
      
    run('bash ./scripts/test_facades.sh')
    run('bash ./scripts/test_facades.sh --sync')
    run('bash ./scripts/video_facades.sh')

I get an error:

python ./scripts/test_before_push_facades.py python train.py --model facades --name temp_facades --dataroot ./datasets/facades --niter 1 --niter_decay 0 --save_latest_freq 10 --display_id -1 Traceback (most recent call last): File "train.py", line 22, in <module> opt = TrainOptions().parse() # get training options File "/home/jupyter/BicycleGAN/options/base_options.py", line 122, in parse opt = self.gather_options() File "/home/jupyter/BicycleGAN/options/base_options.py", line 82, in gather_options model_option_setter = models.get_option_setter(model_name) File "/home/jupyter/BicycleGAN/models/__init__.py", line 46, in get_option_setter model_class = find_model_using_name(model_name) File "/home/jupyter/BicycleGAN/models/__init__.py", line 29, in find_model_using_name modellib = importlib.import_module(model_filename) File "/opt/conda/lib/python3.7/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1006, in _gcd_import File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked ModuleNotFoundError: No module named 'models.facades_model' jupyter@eie-week1-ml-bicyclegan-tesla:~/BicycleGAN$ python ./scripts/test_before_push_facades.py python train.py --model facades --name temp_facades --dataroot ./datasets/facades --niter 1 --niter_decay 0 --save_latest_freq 10 --display_id -1 Traceback (most recent call last): File "train.py", line 22, in <module> opt = TrainOptions().parse() # get training options File "/home/jupyter/BicycleGAN/options/base_options.py", line 122, in parse opt = self.gather_options() File "/home/jupyter/BicycleGAN/options/base_options.py", line 82, in gather_options model_option_setter = models.get_option_setter(model_name) File "/home/jupyter/BicycleGAN/models/__init__.py", line 46, in get_option_setter model_class = find_model_using_name(model_name) File "/home/jupyter/BicycleGAN/models/__init__.py", line 29, in find_model_using_name modellib = importlib.import_module(model_filename) File "/opt/conda/lib/python3.7/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1006, in _gcd_import File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked ModuleNotFoundError: No module named 'models.facades_model'

and if I run the https://github.com/junyanz/BicycleGAN/blob/master/scripts/train_facades.sh
where I update NITER to be 1, I get:

----------------- End ------------------- dataset [AlignedDataset] was created initialize network with xavier model [BiCycleGANModel] was created loading the model from ./pretrained_models/facades/latest_net_G.pth Traceback (most recent call last): File "./video.py", line 30, in <module> model.setup(opt) File "/home/jupyter/BicycleGAN/models/base_model.py", line 90, in setup self.load_networks(opt.epoch) File "/home/jupyter/BicycleGAN/models/base_model.py", line 196, in load_networks net.load_state_dict(state_dict) File "/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 830, in load_state_dict self.__class__.__name__, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for G_Unet_add_all: size mismatch for model.down.0.weight: copying a param with shape torch.Size([64, 11, 4, 4]) from checkpoint, the shape in current model is torch.Size([64, 9, 4, 4]).

any hints? thanks

@junyanz
Copy link
Owner

junyanz commented Jul 6, 2020

You should use --model pix2pix or --model bicycle_gan. This script is mostly for development. Please refer to README on how to test a pre-trained 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

2 participants