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

9 forgetting pipeline #18

Open
wants to merge 50 commits into
base: develop
Choose a base branch
from
Open

9 forgetting pipeline #18

wants to merge 50 commits into from

Conversation

jack89roberts
Copy link
Contributor

@jack89roberts jack89roberts commented Apr 25, 2024

Adds a Forgetter class for Gradient Ascent, Gradient Difference, KL, and "I don't know forgetters", which all inherit from the HuggingFace Trainer, only modifying compute_loss.

Now updated to run with new top level config structure etc. I have successfully run jobs on Baskerville from this branch, but I have not fully verified the outputs are expected. There are runs on wandb under the tofu-test groups, e.g. https://wandb.ai/turing-arc/selective-forgetting/runs/dg1r098f/overview

TODO as part of #25 or in another PR:

  • Currently it's not possible to do forgetting with an eval_dataset / any kind of evaluation during training as the evaluate function in the trainer class doesn't know what to when given 2 data inputs (forget / retain). The evaluate function in arcsf.forget.base need to be implemented to use Jack D's evaluation code (and the trainer should be initialised with eval_dataset set to whatever our appropriate eval dataset instance is).

raise NotImplementedError(
"A Forgetter child class implementing compute_loss should be used"
)

Copy link
Contributor

Choose a reason for hiding this comment

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

Just some general comments on the evaluate method here. Does it need to take the dataset as an argument? In the evaluate_model function in the evaluation branch it takes the config which defines our datasets.

It also takes:

model: torch.nn.Module,
base_truth_ratios_path: str,
tokenizer: transformers.AutoTokenizer,
experiment_config: dict,
random_seed: int,
**generate_kwargs: dict,

So the only requirement beforehand is that the baseline retain model has run the script calculating its truth ratios (all_eval.py). Then we can point to that directory in the config? I had a look at the configs, can we define a retain_model_path when running forget experiments? Everything else should be defined in the script running the experiment.

Otherwise, I can adjust the evaluate_model code, such that it takes as an optional argument eval_dataset. This can be the output of load_dataset, which contains both splits of the data. Then the evaluate_model function will be able to parse these using the dictionary keys 'retain' and 'forget'.

@jack89roberts jack89roberts marked this pull request as ready for review June 14, 2024 16:25
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.

None yet

2 participants