Skip to content

Fix the counterfactual_fairness run script so it actually starts - #763

Open
rootkiller6788 wants to merge 3 commits into
google-deepmind:masterfrom
rootkiller6788:fix-counterfactual-fairness-run-script
Open

rootkiller6788 wants to merge 3 commits into
google-deepmind:masterfrom
rootkiller6788:fix-counterfactual-fairness-run-script

Conversation

@rootkiller6788

Copy link
Copy Markdown

run_adult_pscf.sh hasn't been runnable for a while. absl refuses the --dataset_dir / --num_steps flags the script passes because they were never defined, and once you get past that, adult._read_data crashes trying to use a path string as a context manager, and the data lands in a different directory than --dataset_dir reads.

This defines the two missing flags, opens the csv file with open(), and has download_dataset.sh write into DATA_DIR so the paths line up. num_steps only overrides the config when it's actually passed, so existing usage is unchanged.

Verified by importing adult_pscf with the heavy deps stubbed and parsing the exact command line the script emits (original bails with UnrecognizedFlagError, fixed parses cleanly), and by running _read_data against a small synthetic csv. Closes #421.

adult._read_data was doing `with os.path.join(...) as data_file`, which
tries to use a plain path string as a context manager and blows up with
TypeError. Wrap it in open() so the csv is actually read.
run_adult_pscf.sh calls adult_pscf with --dataset_dir and --num_steps but
neither flag was defined, so absl bailed out with an unknown-flag error
before main even started. dataset_dir feeds read_all_data, and num_steps
falls back to the config value when it's not given.
download_dataset.sh was told to write into TMP_DIR while --dataset_dir
pointed at TMP_DIR/adult, so read_all_data looked for the files in a
subdir that never got populated. Point the download at DATA_DIR.
@polarbe

polarbe commented Aug 30, 2026 via email

Copy link
Copy Markdown

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.

Missing flag definitions

2 participants

⌂ Proxy