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

Make output_dir Optional in TrainingArguments #27866 #35735

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

sambhavnoobcoder
Copy link

Description

This PR addresses an issue where specifying an output_dir was mandatory in TrainingArguments. 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 to None.
• Default to a built-in location (e.g., "tmp_trainer") if None 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 :
Screenshot 2025-01-16 at 10 57 20 PM

cc : @ArthurZucker @Rocketknight1

@Rocketknight1
Copy link
Member

cc @SunMarc @muellerzr for Trainer!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make output_dir optional in TrainingArguments
2 participants