Skip to content

Commit

Permalink
Make training_args.to_dict handle the AcceleratorConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
muellerzr committed Feb 14, 2024
1 parent 1de6ff5 commit f5b4281
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/transformers/training_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -2208,6 +2208,9 @@ def to_dict(self):
d[k] = [x.value for x in v]
if k.endswith("_token"):
d[k] = f"<{k.upper()}>"
# Handle the accelerator_config if passed
if is_accelerate_available() and isinstance(v, AcceleratorConfig):
d[k] = v.to_dict()
return d

def to_json_string(self):
Expand Down

0 comments on commit f5b4281

Please sign in to comment.