nmichlo / disent

🧶 Modular VAE disentanglement framework for python built with PyTorch Lightning ▸ Including metrics and datasets ▸ With strongly supervised, weakly supervised and unsupervised methods ▸ Easily configured and run with Hydra config ▸ Inspired by disentanglement_lib
https://disent.michlo.dev
MIT License
124 stars 18 forks source link

[Q]: Command to run with defaults? #23

Closed cianeastwood closed 2 years ago

cianeastwood commented 2 years ago

Hi there,

What's the simplest way to train a VAE on cars3d with all the default settings? Is there a single command that does this, using all the yaml config files? E.g. cars3d needs to be downsampled to 64x64, and this is specified in its yaml file. Not very familiar with Hydra, so I'm not sure how to automatically load the yaml config files.

Thanks in advance, and for providing this great framework!

nmichlo commented 2 years ago

Hi!

This simplest way would be to clone the repo:

  1. change your working directory to the root:
    cd disent
  2. install the requirements
    pip3 install requirements.txt
    pip3 install requirements-experiment.txt
  3. run the experiment (this is the custom script we provide to load the hydra config files)
    • Unfortunately I see there is a config bug left over from research code that I am currently trying to extract into a separate project, meaning the general run settings are wrong. I have added a marker to fix this for the next release of disent. The command line options that start with run_* you should be able to remove in the next version.
      PYTHONPATH=. python3 experiment/run.py framework=betavae dataset=cars3d framework.beta=0.01 \
      run_location=local_cpu run_launcher=local run_logging=none  # config bug workaround

      If you would like to enable logging to W&B you can enable this by adding or changing the following command line options:

      PYTHONPATH=. python3 experiment/run.py framework=betavae dataset=cars3d framework.beta=0.01 \
      run_location=local_cpu run_launcher=local \
      run_logging=wandb settings.job.user="your_wandb_username" settings.job.project="your_wandb_project" 

You'll notice if you look at the experiment/config/config.yaml file, these command line options correspond to the options set in the defaults list at the top of the file.


Definitely need to add this to the docs! Improvements to those are in the roadmap!

nmichlo commented 2 years ago

This has been fixed in 5695747c1e94420c024f1505d9b8a4b3c81ad610 release v0.3.4

The simplest command should now be:

PYTHONPATH=. python3 experiment/run.py framework=betavae dataset=cars3d

or adjusting beta:

PYTHONPATH=. python3 experiment/run.py framework=betavae dataset=cars3d framework.beta=0.01
cianeastwood commented 2 years ago

This is fantastic!! Thank you for addressing this so quickly and thoroughly – appreciate it! The simple command really helps usability :)

nmichlo commented 2 years ago

No problem, glad to help!