-
Notifications
You must be signed in to change notification settings - Fork 54
feat: add WMDP dataset integration #93
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
WMDP_cyber_forget: | ||
handler: QADataset | ||
args: | ||
hf_args: | ||
path: "cais/wmdp" | ||
name: "wmdp-cyber" | ||
split: "test" | ||
question_key: "question" | ||
answer_key: "answer" | ||
choices_key: "choices" | ||
max_length: 512 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
WMDP_cyber_forget_corpus: | ||
handler: PretrainingDataset | ||
args: | ||
hf_args: | ||
path: "cais/wmdp-corpora" | ||
name: "cyber-forget-corpus" | ||
split: "train" | ||
text_key: "text" | ||
max_length: 2048 |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's the same as WMDP_cyber_forget.yaml There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ruidazeng I don't see the path existing for this dataset in hf. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You mean for MMLU? Yeah, it's not in From what I understand, in original setup, training is done on:
And evaluation on:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see you mentioned in #80 that evaluation won't be done here anyway, but only afterwards, so I guess There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
WMDP_cyber_retain: | ||
handler: QADataset | ||
args: | ||
hf_args: | ||
path: "cais/wmdp" | ||
name: "wmdp-cyber" | ||
split: "test" | ||
question_key: "question" | ||
answer_key: "answer" | ||
choices_key: "choices" | ||
max_length: 512 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
WMDP_cyber_retain_corpus: | ||
handler: PretrainingDataset | ||
args: | ||
hf_args: | ||
path: "cais/wmdp-corpora" | ||
name: "cyber-retain-corpus" | ||
split: "train" | ||
text_key: "text" | ||
max_length: 2048 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# @package eval.wmdp | ||
# NOTE: the above line is not a comment, but sets the package for config. See https://hydra.cc/docs/upgrades/0.11_to_1.0/adding_a_package_directive/ | ||
|
||
defaults: # include all defined metrics files | ||
- tofu_metrics: # Reusing TOFU metrics for WMDP evaluation | ||
- forget_quality | ||
- forget_Q_A_Prob | ||
- forget_Q_A_ROUGE | ||
- model_utility | ||
- privleak | ||
- extraction_strength | ||
|
||
handler: WMDPEvaluator | ||
output_dir: ${paths.output_dir} # set to default eval directory | ||
metrics: {} # lists a mapping from each evaluation metric to its config | ||
# populated through the first (@package) line in each metric config | ||
overwrite: false | ||
forget_split: test | ||
holdout_split: test | ||
retain_logs_path: null |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# WMDP Unlearning Configuration | ||
|
||
defaults: | ||
- override /model: Llama-3.2-1B-Instruct | ||
- override /trainer: RMU | ||
- override /data: unlearn | ||
- override /data/datasets@data.forget: WMDP_cyber_forget_corpus | ||
- override /data/datasets@data.retain: WMDP_cyber_retain_corpus | ||
- override /eval: wmdp | ||
|
||
model: | ||
model_args: | ||
pretrained_model_name_or_path: meta-llama/Llama-3.2-1B-Instruct | ||
|
||
forget_split: train | ||
retain_split: train | ||
holdout_split: test | ||
retain_logs_path: null | ||
|
||
eval: | ||
wmdp: | ||
forget_split: ${forget_split} | ||
holdout_split: ${holdout_split} | ||
retain_logs_path: ${retain_logs_path} | ||
overwrite: true | ||
|
||
data: | ||
anchor: forget | ||
forget: | ||
WMDP_cyber_forget_corpus: | ||
args: | ||
hf_args: | ||
name: "cyber-forget-corpus" | ||
split: ${forget_split} | ||
retain: | ||
WMDP_cyber_retain_corpus: | ||
args: | ||
hf_args: | ||
name: "cyber-retain-corpus" | ||
split: ${retain_split} | ||
|
||
trainer: | ||
args: | ||
warmup_epochs: 1.0 | ||
learning_rate: 1e-5 | ||
weight_decay: 0.01 | ||
num_train_epochs: 10 | ||
|
||
task_name: wmdp_cyber_unlearning |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from evals.base import Evaluator | ||
|
||
|
||
class WMDPEvaluator(Evaluator): | ||
def __init__(self, eval_cfg, **kwargs): | ||
super().__init__("WMDP", eval_cfg, **kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to update just before merge