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

expanduser path in Trainer #10628

Closed
PaulLerner opened this issue Mar 10, 2021 · 3 comments
Closed

expanduser path in Trainer #10628

PaulLerner opened this issue Mar 10, 2021 · 3 comments

Comments

@PaulLerner
Copy link
Contributor

the output_dir passed to TrainingArguments is not expanded (the behaviour is probably the same for logging_dir)

Who can help

Library:

To reproduce

Directly using os.makedirs but this is what happens in Trainer

In [7]: !mkdir ~/foo

In [8]: !cd ~/foo
/mnt/beegfs/home/lerner/foo

In [10]: os.makedirs("~/bar")

In [14]: !realpath "~/bar"
/mnt/beegfs/home/lerner/foo/~/bar

To fix

Call os.path.expanduser before making dir

In [10]: os.makedirs(os.path.expanduser("~/bar"))

In [18]: cd
/mnt/beegfs/home/lerner

In [21]: !realpath bar
/mnt/beegfs/home/lerner/bar
@sgugger
Copy link
Collaborator

sgugger commented Mar 10, 2021

Sounds reasonable. Would you like to make a PR with this change?

@PaulLerner
Copy link
Contributor Author

Can do.
I should expand the path in TrainingArguments right? for logging_dir also?

@sgugger
Copy link
Collaborator

sgugger commented Mar 10, 2021

Yes, output_dir and logging_dir, preferable in the postinit of TrainingArguments so it's done as early as possible.

PaulLerner added a commit to PaulLerner/transformers that referenced this issue Mar 11, 2021
Iwontbecreative pushed a commit to Iwontbecreative/transformers that referenced this issue Jul 15, 2021
…ace#10660)

* fix: huggingface#10628 expanduser path in TrainingArguments

* docs: explain why we expand paths in TrainingArguments

* Style

Co-authored-by: Sylvain Gugger <sylvain.gugger@gmail.com>
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

No branches or pull requests

2 participants