Open simonschoe opened 11 months ago
Hello!
Hmmm, this is a tricky one. To give a bit of context, setfit borrows the Callbacks from transformers
, even though setfit uses a different Trainer and TrainingArguments. So far I've been able to avoid any issues by also implementing certain variables on the setfit TrainingArguments
(e.g. report_to
, run_name
, etc.), but it seems that the WandbCallback
on_train_end
for some reason loads the transformers
Trainer here, and there's not too much I can do about that.
I don't believe I can reasonably fix this I'm afraid.
You could try overwritting the class method on_train_end
.
I had a similar issue when using NeptuneCallback
, because the TrainingArguments
class in SetFit
is missing overwrite_output_dir
as an argument:
File "C:\***\lib\site-packages\transformers\integrations\integration_utils.py", line 1343, in on_init_end
if self._log_checkpoints and (args.overwrite_output_dir or args.save_total_limit is not None):
AttributeError: 'TrainingArguments' object has no attribute 'overwrite_output_dir'
To overcome this I just removed args.overwrite_output_dir
, because I did not need it in my case:
from transformers.integrations import NeptuneCallback
class NeptuneCallbackSetFit(NeptuneCallback):
def on_init_end(self, args, state, control, **kwargs):
self._volatile_checkpoints_dir = None
if self._log_checkpoints and (args.save_total_limit is not None):
self._volatile_checkpoints_dir = tempfile.TemporaryDirectory().name
if self._log_checkpoints == "best" and not args.load_best_model_at_end:
raise ValueError("To save the best model checkpoint, the load_best_model_at_end argument must be enabled.")
I don't know your usecase, but maybe removing or exchanging the Trainer
in WandbCallback
helps!
@simonschoe did you find any solution for this issue.
When settting
os.environ["WANDB_LOG_MODEL"] = "end"
prior to the training loop and specifyreport_to='wandb'
inTrainingArguments
, I receive the following error:Occurs only when I set the
WANDB_LOG_MODEL
environment variable, otherwise it runs smoothly.