Skip to content

Commit

Permalink
major fixes to configs
Browse files Browse the repository at this point in the history
  • Loading branch information
natolambert committed Jul 25, 2024
1 parent 841039f commit f0c0ca5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion configs/beaker_configs/default_finetune.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ tasks:
command: [
'/bin/sh', '-c'
]
arguments: ['accelerate launch
arguments: ['PYTHONPATH="/stage:$PYTHONPATH" accelerate launch
--mixed_precision bf16
--num_machines 1
--num_processes 4
Expand Down
17 changes: 12 additions & 5 deletions scripts/submit_finetune_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,21 +99,28 @@ def parse_args(args):
script_index = cmd_parts.index('open_instruct/finetune.py')

# Separate the command into pre-script and post-script parts
pre_script = cmd_parts[:2] # 'accelerate launch'
pre_script_args = cmd_parts[2:script_index]
pre_script = cmd_parts[:3] # 'accelerate launch'
pre_script_args = cmd_parts[3:script_index]
post_script_args = cmd_parts[script_index+1:]

# Parse arguments
pre_dict = parse_args(pre_script_args)
post_dict = parse_args(post_script_args)

# Combine dictionaries and apply overrides
cmd_dict = {**pre_dict, **post_dict}
cmd_dict = {**post_dict}
cmd_dict.update(train_config)
cmd_dict.update(unknown_args)

# Reconstruct the command string
new_cmd_parts = pre_script + ['open_instruct/finetune.py']
new_cmd_parts = pre_script
# add pre python args
for key, value in pre_dict.items():
new_cmd_parts.append(f'--{key}')
if value is not True:
new_cmd_parts.append(str(value))
# add python job + post args
new_cmd_parts.append('open_instruct/finetune.py')
for key, value in cmd_dict.items():
new_cmd_parts.append(f'--{key}')
if value is not True:
Expand Down

0 comments on commit f0c0ca5

Please sign in to comment.