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

save configuration to wandb #217

Merged
merged 5 commits into from
Jun 11, 2024
Merged

save configuration to wandb #217

merged 5 commits into from
Jun 11, 2024

Conversation

peterdudfield
Copy link
Contributor

Pull Request

Description

  • save configruation,
  • hydra and wandb should save it, but there is an issue with _target_ dicts, and tricky to find out where the error was. Easier to save the file directly

#168

How Has This Been Tested?

Ran it locally

  • Yes

Checklist:

  • My code follows OCF's coding style guidelines
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked my code and corrected any misspellings

@peterdudfield peterdudfield requested review from dfulu and Sukh-P June 11, 2024 09:44
os.makedirs("./configuration", exist_ok=True)
shutil.copyfile(data_config, "./configuration/data_config.yaml")
OmegaConf.save(config, "./configuration/config.yaml")
wandb_logger.experiment.save("./configuration/data_config.yaml")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we not just upload f"{callback.dirpath}/model_config.yaml" and f"{config.datamodule.batch_dir}/data_configuration.yaml" since these already exist rather than saving them to ./configuration first?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file structure in wandb matches the file strcutre of the files uploaded, and I wanted it neat, rather than some mnt/storage4tb_b/..../ for the data configuration. But perhaps there is a neater way to do it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried running this:

logger.experiment.save("/home/jamesfulton/repos/PVNet_summation/checkpoints/znoi18se/model_config.yaml")

and the file appears here without any subdirectories. So that suggests logger.experiment.save(f"{callback.dirpath}/model_config.yaml") should work and save without subdirs?

But maybe I'm missing something, and if that doesn't work can we just delete ./configuration after uploading to wandb to keep things tidy?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, yea, ok I could try that.
How do you feel about override the current config.yaml in wandb with a new one? My feeling is that we should save both

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeh I'd save both

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like I have to use wandb_logger.experiment.save(f"{callback.dirpath}/data_config.yaml", callback.dirpath) to make sure its not in a sub folder. Im on a slightly high wandb version that you @dfulu

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@peterdudfield peterdudfield merged commit ae937dd into main Jun 11, 2024
3 checks passed
@peterdudfield peterdudfield deleted the wandb-config branch June 11, 2024 13:12
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

Successfully merging this pull request may close these issues.

2 participants