-
Notifications
You must be signed in to change notification settings - Fork 27.8k
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
Make output_dir
Optional in TrainingArguments
#27866
#35735
base: main
Are you sure you want to change the base?
Make output_dir
Optional in TrainingArguments
#27866
#35735
Conversation
cc @SunMarc @muellerzr for Trainer! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mind making it optional ! Left a comment. Can you have a second look @muellerzr ? Also call make style
to fix the CI !
src/transformers/training_args.py
Outdated
output_dir (`str`, *optional*): | ||
The output directory where the model predictions and checkpoints will be written. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the description to include the default value for output_dir
. We can maybe call it trainer_output
WDYT ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes i agree , trainer_output
sounds more intitutive .I've made that change as well as updated the descriptions in 7831474 commit .
Also , the PR is now clean and ready for merging .
Description
This PR addresses an issue where specifying an
output_dir
was mandatory inTrainingArguments
. This behavior could be confusing or cumbersome in scenarios where users do not necessarily need a dedicated output directory or prefer to let the library handle default paths.By making
output_dir
optional and defaulting to a temporary directory (named"tmp_trainer"
) when not specified, we simplify the API usage. If a user later needs to track outputs in a dedicated directory, they can still provide a valid path.Fixes : #27866
Proposed Solution
• Allow
output_dir
to be set toNone
.• Default to a built-in location (e.g.,
"tmp_trainer"
) ifNone
is provided.Implementation
The changes introduce a check to automatically assign a default directory if none is specified. This preserves backward compatibility for users already specifying
output_dir
while improving the experience for those who prefer a simpler workflow.Testing
• Added a test covering the scenario when
output_dir
is not provided.• Verified existing tests using a custom
output_dir
are unaffected.• Extended tests to ensure the directory is only created when needed (depending on the save strategy).
Screenshots
Below is a screenshot of all testcases passing :
cc : @ArthurZucker @Rocketknight1