Skip to content

Commit

Permalink
Refactor training_args serialization to only include defined dataclas…
Browse files Browse the repository at this point in the history
…s fields
  • Loading branch information
not-lain committed Dec 27, 2024
1 parent 2c2198c commit 9741c8f
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/transformers/training_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,8 @@ def wrapper(self, *args, **kwargs):

for name, value in bound_args.arguments.items():
if name not in ["self", "args"] and value is not None:
self.__training_args_params__[name] = serialize_parameter(name, value)
# Handle extra positional arguments
# extra_args = bound_args.arguments.get("args", [])
# if extra_args and extra_args != []:
# print("Extra args: ", extra_args)
# print("Extra args type: ", type(extra_args))
# self.__training_args_params__["args"] = list(extra_args)
if name in self.__dataclass_fields__.keys():
self.__training_args_params__[name] = serialize_parameter(name, value)

return func(self, *args, **kwargs)

Expand Down

0 comments on commit 9741c8f

Please sign in to comment.