google-research / disentanglement_lib

disentanglement_lib is an open-source library for research on learning disentangled representations.
Apache License 2.0
1.38k stars 205 forks source link

running dlib_postprocess: what values should the flags gin_config and gin_bindings take? #21

Open mencia opened 4 years ago

mencia commented 4 years ago

I downloaded the pretrained model with index 0. To start playing with the model, I want to run dlib_postprocess. I need to give values to the following four flags: 1) model_dir: "Directory to take trained model from." 2) output_dir: "Directory to save extracted representation to." 3) gin_config: "List of paths to the config files." 4) gin_bindings: "Newline separated list of Gin parameter bindings."

The first two are obvious:

--model_dir=../0/model/tfhub --output_dir=wherever_I_want_to_save_the_output_of_postprocessing

The last two are less clear to me. For gin_config I tried:

--gin_config= ../0/postprocessed/mean/results/gin/postprocess.gin

And I got the following error:

Traceback (most recent call last): File "/home/mencia/Internship/Projects/Disentanglement_Locatello/env/bin/dlib_postprocess", line 45, in <module> app.run(main) File "/home/mencia/Internship/Projects/Disentanglement_Locatello/env/lib/python3.5/site-packages/absl/app.py", line 299, in run _run_main(main, args) File "/home/mencia/Internship/Projects/Disentanglement_Locatello/env/lib/python3.5/site-packages/absl/app.py", line 250, in _run_main sys.exit(main(argv)) File "/home/mencia/Internship/Projects/Disentanglement_Locatello/env/bin/dlib_postprocess", line 41, in main FLAGS.gin_bindings) File "/home/mencia/Internship/Projects/Disentanglement_Locatello/env/lib/python3.5/site-packages/disentanglement_lib/postprocessing/postprocess.py", line 55, in postprocess_with_gin gin.parse_config_files_and_bindings(gin_config_files, gin_bindings) File "/home/mencia/Internship/Projects/Disentanglement_Locatello/env/lib/python3.5/site-packages/gin/config.py", line 1634, in parse_config_files_and_bindings parse_config_file(config_file, skip_unknown) File "/home/mencia/Internship/Projects/Disentanglement_Locatello/env/lib/python3.5/site-packages/gin/config.py", line 1602, in parse_config_file raise IOError(err_str.format(config_file, prefixes)) OSError: Unable to open file: ~/Internship/Projects/Disentanglement_Locatello/pretrained_models/0/postprocessed/sampled/results/gin/postprocess.gin. Searched config paths: [''].

I also tried importing sweep to dlib_postprocess and defining:

gin_bindings, gin_config = get_model_config(model_num=0)

But this did not work either.

How can I run dlib_postprocess?