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

fix: Remove deprecated push_to_hub_token to resolve warning #419

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
5 changes: 2 additions & 3 deletions tuning/sft_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

# Standard
from typing import Callable, Dict, List, Optional, Union
import dataclasses
import json
import logging
import os
Expand Down Expand Up @@ -346,10 +345,10 @@ def train(
# from our object directly. In the future, we should consider renaming this class and / or
# not adding things that are not directly used by the trainer instance to it.

transformer_train_arg_fields = [x.name for x in dataclasses.fields(SFTConfig)]
transformer_train_arg_fields = SFTConfig.__dict__["__match_args__"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use of __match_args__ requires Python>=3.10 isn't it? Correct me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I believe it is Python 3.10 and greater. Although I'm a little confused on whether __match_args__ are auto generated by Python when creating a class or manually set by those writing the class. As it is now, it is a key in the dictionary, so I wonder if the key would still exist in Python 3.9 and lower.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we should avoid usage of __match_args__ in that case, WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess so, which version of Python is the lowest supported by fms-hf-tuning repo?

Also, if we remove __match_args__ do you know another way to get all the input variables for SFTConfig as listed here? Using __dict__.keys() only returns the 12 parameters, but I need all of the variables that SFTConfig inherits from TrainingArguments class. For example, output_dir, do_train, do_eval etc.

transformer_kwargs = {
k: v
for k, v in train_args.to_dict().items()
for k, v in train_args.__dict__.items()
if k in transformer_train_arg_fields
}

Expand Down
Loading