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

8 fine tuning #14

Merged
merged 101 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from 85 commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
bcb9b7b
model and tokenizer loading
philswatton Apr 18, 2024
2b6ba63
additional dependencies
philswatton Apr 18, 2024
3f69c81
configs, training script, generation
philswatton Apr 18, 2024
2cfed79
removed generated configs accidentally commited
philswatton Apr 18, 2024
a9e5028
train args
philswatton Apr 18, 2024
38562f3
early bask script generation
philswatton Apr 18, 2024
dac3fe5
removed depracted property
philswatton Apr 30, 2024
a331b61
added wandb, broke toplevel config in process
philswatton Apr 30, 2024
c994e07
placeholder preprocessing
philswatton Apr 30, 2024
6180a99
dependencies
philswatton Apr 30, 2024
7e11b51
example tofu configs
philswatton Apr 30, 2024
0b8fb48
added placeholders for 1st debug run, almost ready to run
philswatton Apr 30, 2024
88c8735
placeholder data config loading
philswatton Apr 30, 2024
f824f8c
added remaining required placeholders
philswatton Apr 30, 2024
662799d
fixed mistake in copying wandb config
philswatton Apr 30, 2024
05b9d0f
to dict method started
philswatton Apr 30, 2024
290ccfa
fixed import error
philswatton May 1, 2024
d3aecc2
fixed name of from_yaml
philswatton May 1, 2024
3a719d7
fixed path typo
philswatton May 1, 2024
dc84fda
fixed kwarg error
philswatton May 1, 2024
4525606
fixed misaligned class and config names
philswatton May 1, 2024
b35ad39
added seed kwarg
philswatton May 1, 2024
2338796
added vscode ignore
philswatton May 1, 2024
ba55154
bugs for days
philswatton May 1, 2024
20fe114
kill me now
philswatton May 1, 2024
6cbfc6c
last fix
philswatton May 1, 2024
0a76af6
fixed str learning rate
philswatton May 3, 2024
7684f31
:construction: tmp - quick way to ensure unique save dir
jack89roberts May 7, 2024
8d51b6a
:wrench: 100 epoch, default LR, gpt2 job for comparison
jack89roberts May 7, 2024
527c90d
:wrench: add missing slurm script from previous commit
jack89roberts May 7, 2024
4150b78
:wrench: reduce walltime
jack89roberts May 7, 2024
d3d5896
:wrench: trainingargs doesn't like null logging steps
jack89roberts May 7, 2024
d1eea19
:wrench: save strategy to epoch too...
jack89roberts May 7, 2024
97b13ed
remove colon from placeholder preprocessing
jack89roberts May 7, 2024
cd69dbf
:safety_vest: only save max 2 checkpoints per experiment
jack89roberts May 7, 2024
ae1d12d
wip train on all data
jack89roberts May 7, 2024
5286c55
train on retain or all quick add
jack89roberts May 7, 2024
f37cfd2
update submit scripts
jack89roberts May 7, 2024
6ca1943
walltime
jack89roberts May 7, 2024
3c42751
trainer kwargs kept as dict
philswatton May 9, 2024
0ade9e2
wandb arg to trainer
philswatton May 9, 2024
5771b35
updated kwarg processing
philswatton May 9, 2024
f95422a
full arg names in configs
philswatton May 10, 2024
d5b40fe
removed wandb arg in model configs
philswatton May 10, 2024
9f026b5
more config updates
philswatton May 10, 2024
fab38b2
added optional second dataset to training, removed wandb from model c…
philswatton May 10, 2024
6e32a29
report to none as intended
philswatton May 10, 2024
73253a8
seed in trainer, trainer class now determined by string
philswatton May 10, 2024
cd91403
early stopping now optional
philswatton May 10, 2024
73eb67d
steps can already be floats
philswatton May 10, 2024
8bf73c8
absolute project path added
philswatton May 10, 2024
1351110
now using absolute paths (except for output, which is still TODO)
philswatton May 10, 2024
e0292c4
file renames
philswatton May 10, 2024
fb44636
renamed imports
philswatton May 10, 2024
5e71095
removed easier imports
philswatton May 10, 2024
8c6c13c
experiment config to_dict
philswatton May 10, 2024
f4159c9
moved constants
philswatton May 10, 2024
aa13b32
adding padding token now optional
philswatton May 10, 2024
90b6590
separate hyperparameters config
philswatton May 10, 2024
8863c1b
enabled LoRA (in theory)
philswatton May 10, 2024
17e50fc
data config
philswatton May 16, 2024
e80f19d
resolved tofu.py merge conflict
philswatton May 16, 2024
cd59b3e
data config added to experiment config
philswatton May 16, 2024
45662a7
slightly changing configs
philswatton May 16, 2024
fd2b1ef
rename
philswatton May 16, 2024
5a4ce10
renamed yaml file to be used
philswatton May 16, 2024
25d6e6d
paths
philswatton May 16, 2024
d37aa8e
docstrings on base and experiment configs
philswatton May 16, 2024
c783e21
docstrings
philswatton May 16, 2024
c78d3c3
removed placeholder comments
philswatton May 16, 2024
194ee62
top config generation
philswatton May 20, 2024
f9bfec2
some extra ignores
philswatton May 20, 2024
b6e88ae
tweak to config cls
philswatton May 21, 2024
2a62e2b
config tests
philswatton May 21, 2024
f5aa067
more useful gitignore
philswatton May 21, 2024
146cd0d
finished up config init tests
philswatton May 21, 2024
95f0943
not testing these - just calls to other fns
philswatton May 22, 2024
2730763
integrated preprocessing PR
philswatton May 22, 2024
4fbf9cf
top config now uses array job submission
philswatton May 22, 2024
7427f13
debug top config:
philswatton May 22, 2024
1cd3c23
more debugging
philswatton May 22, 2024
8bd22f4
fixed data configs
philswatton May 22, 2024
a9d477c
updated data cfg test
philswatton May 23, 2024
d429300
bug fixing
philswatton May 23, 2024
458f5c1
finished README sections for PR
philswatton May 23, 2024
6c86740
Update src/arcsf/models/model.py
philswatton May 28, 2024
068e47f
Update src/arcsf/config/experiment.py
philswatton May 28, 2024
f775085
removed cpu per gpu
philswatton May 28, 2024
0c3878c
fixed error from treating str as path
philswatton May 28, 2024
c4b6df3
updated argparse docstring
philswatton May 28, 2024
8c6cf85
short fn names + args to single line
philswatton May 28, 2024
455f13b
docstrings for top config fns
philswatton May 28, 2024
033d434
Update src/arcsf/config/experiment.py
philswatton May 28, 2024
dbb7184
copy -> deepcopy
philswatton May 28, 2024
dafea7e
Update src/arcsf/config/experiment.py
philswatton May 28, 2024
e6c9bd3
Update src/arcsf/config/experiment.py
philswatton May 28, 2024
76dd37d
Update src/arcsf/config/experiment.py
philswatton May 28, 2024
bba0633
Update src/arcsf/config/experiment.py
philswatton May 28, 2024
512eadc
Update src/arcsf/config/experiment.py
philswatton May 28, 2024
d774c9b
rename fn
philswatton May 28, 2024
a576e96
refactored top config generation
philswatton May 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Mac OS
.DS_Store
wandb/

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down Expand Up @@ -130,3 +131,10 @@ dmypy.json

# Pyre type checker
.pyre/

# Vscode
.vscode/

# Project related
configs/experiment/*/
train_scripts/
7 changes: 7 additions & 0 deletions configs/data/example_tofu_1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dataset_name: tofu
data_kwargs:
granularity: question
stratified: true
forget_random: true
forgotten_author_fraction: 0.2
forgotten_fact_fraction: 0.2
7 changes: 7 additions & 0 deletions configs/data/example_tofu_2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dataset_name: tofu
data_kwargs:
granularity: question
stratified: true
forget_random: true
forgotten_author_fraction: 0.1
forgotten_fact_fraction: 0.4
9 changes: 9 additions & 0 deletions configs/data/example_tofu_full.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# The only fields that matter in this one are the fractions - this means the full
# TOFU dataset will be returned as retain and nothing will be returned as forget
dataset_name: tofu
data_kwargs:
granularity: question
stratified: false
forget_random: false
forgotten_author_fraction: 0.0
forgotten_fact_fraction: 0.0
33 changes: 33 additions & 0 deletions configs/experiment/example_top_experiment_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Combinations to build runs over
combinations:
data_config:
- example_tofu_1
- example_tofu_2
model_config:
- [gpt2, shorter]
- [gpt2, longer]
seed:
- 42
- 43
- 44
# TODO: add other configs that define a group of experiments end to end

# Full data config: which dataset to use to build full model to do forgetting on
full_data_config: example_tofu_full

# Baskerville kwargs
use_bask: true
bask:
walltime: '0-5:0:0'
gpu_number: 1
node_number: 1
cpu_per_gpu: 36

# Wandb kwargs
wandb_kwargs:
use_wandb: true
wandb_config:
entity: turing-arc
project: selective-forgetting
log_model: "false"
group: debug-runs
19 changes: 19 additions & 0 deletions configs/experiment/gpt2_longer_experiment_full.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Type: retain or full model
train_type: full

# All of thse should be contained under configs/type/
data_config: example_tofu_1
model_config: gpt2
hyperparameter_config: longer
# TODO: add other configs that define a single experiment end to end

# Seed for random components
seed: 42

# Wandb kwargs
use_wandb: true
wandb_config:
entity: turing-arc
project: selective-forgetting
log_model: "false"
group: debug-runs
22 changes: 22 additions & 0 deletions configs/experiment/gpt2_longer_experiment_retain.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Type: retain or full model
train_type: retain

# Path to full model to compare this model against.
full_model_name: gpt2_longer_experiment_full

# All of thse should be contained under configs/type/
data_config: example_tofu_1
model_config: gpt2
hyperparameter_config: longer
# TODO: add other configs that define a single experiment end to end

# Seed for random components
seed: 42

# wandb kwargs
use_wandb: true
wandb_config:
entity: turing-arc
project: selective-forgetting
log_model: "false"
group: debug-runs
4 changes: 4 additions & 0 deletions configs/model/gpt2/gpt2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
model_id: gpt2 # The name as found on HuggingFace to load the model with
model_kwargs: # passed to AutoModelForCausalLM.from_pretrained
device_map: auto
add_padding_token: True
27 changes: 27 additions & 0 deletions configs/model/gpt2/hyperparameters/longer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
trainer_kwargs: # passed to TrainingArguments
# Batch size
per_device_train_batch_size: 1
per_device_eval_batch_size: 1
gradient_accumulation_steps: 1

# Core hyperparameters
learning_rate: 5.e-5
num_train_epochs: 50

# Evaluation
evaluation_strategy: epoch

# Logging
logging_strategy: epoch

# Early stopping
load_best_model_at_end: true
metric_for_best_model: eval_loss
save_strategy: epoch
save_total_limit: 1

# Outputs
output_dir: output
# Early stopping kwargs (only needed if save strategy is not null)
early_stopping_kwargs:
early_stopping_patience: 2
28 changes: 28 additions & 0 deletions configs/model/gpt2/hyperparameters/shorter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
trainer_kwargs: # passed to TrainingArguments
# Batch size
per_device_train_batch_size: 1
per_device_eval_batch_size: 1
gradient_accumulation_steps: 1

# Core hyperparameters
learning_rate: 5.e-5
num_train_epochs: 10

# Evaluation
evaluation_strategy: steps

# Logging
logging_strategy: steps
logging_steps: 0.5 # can be float or int

# Early stopping
load_best_model_at_end: true
metric_for_best_model: eval_loss
save_strategy: steps
save_total_limit: 1

# Outputs
output_dir: output
# Early stopping kwargs (only needed if save strategy is not null)
early_stopping_kwargs:
early_stopping_patience: 2
Loading