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

KeyError: 'optimizers' #5

Open
Bailey-24 opened this issue Apr 11, 2022 · 2 comments
Open

KeyError: 'optimizers' #5

Bailey-24 opened this issue Apr 11, 2022 · 2 comments

Comments

@Bailey-24
Copy link

I want to pretrain generator network, use command python main.py --name pretrain_gn --mode pretrain_gn --ae_checkpoint_path runs/train_ae/vae_099.pth --num_processes=1
But I got this .

Traceback (most recent call last):
  File "main.py", line 55, in <module>
    pretrain_gn(args, config)
  File "/run_code/fit2form-master/train.py", line 697, in pretrain_gn
    setup_pretrain(args, config)
  File "/run_code/fit2form-master/utils.py", line 388, in setup_pretrain
    net = setup_network(args, hyperparameters)
  File "/run_code/fit2form-master/utils.py", line 304, in setup_network
    checkpoint_dict={"ae_checkpoint_path": args.ae_checkpoint_path}
  File "/run_code/fit2form-master/learning/gripperDesigner.py", line 122, in __init__
    self.load_ae_checkpoint(checkpoint_dict["ae_checkpoint_path"])
  File "/run_code/fit2form-master/learning/gripperDesigner.py", line 167, in load_ae_checkpoint
    optimizers = checkpoint['optimizers']
KeyError: 'optimizers'
@submagr
Copy link
Contributor

submagr commented Apr 16, 2022

Hi @Bailey-24,
Can you print checkpoint.keys() before line 167. Seems like the model is loaded via checkpoint, but the checkpoint dict does not have optimizers saved for some reason (looking into it but seems like the optimizer is saved with key vae_optimizer)

Meanwhile, you can comment out these two lines since the default optimizer is already specified in the init function.

@submagr
Copy link
Contributor

submagr commented Apr 17, 2022

Hi @Bailey-24,
I have updated the code addressing your findings. Please pull and follow the instructions in the updated readme.

I would advise creating a small subset of ShapeNetCore.v2 for quickly testing the code. While doing so, please make sure that you have at least one category from the train_categories.txt and val_categories.txt files.

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