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

Added --output-dir-use-symlinks for tune download with default as auto #816

Merged
merged 2 commits into from
Apr 22, 2024

Conversation

apthagowda97
Copy link
Contributor

@apthagowda97 apthagowda97 commented Apr 19, 2024

Context

Changelog

Test plan

Copy link

pytorch-bot bot commented Apr 19, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/torchtune/816

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 41dc36f with merge base 41341fd (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot
Copy link

Hi @apthagowda97!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

"--output-dir-use-symlinks",
type=str,
required=False,
default="False",
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we default this to 'auto' to mimic the behavior from before?

Copy link
Contributor Author

@apthagowda97 apthagowda97 Apr 19, 2024

Choose a reason for hiding this comment

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

If we are downloading model to --output-dir folder. Why simply store that model in .cache ?
By selecting "auto" as default .. deletion of the model wont work properly and we need to run huggingface-cli delete-cache to delete.

Let me know your thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

I understand your point and we can add a note about that in the documentation somewhere, but I'd like to keep the defaults the same for args that map 1:1 to Hugging Face CLI commands.


# Raise if local_dir_use_symlinks is invalid
output_dir_use_symlinks: Union[Literal["auto"], bool]
use_symlinks_lowercase = args.output_dir_use_symlinks.lower()
Copy link
Contributor

Choose a reason for hiding this comment

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

argparse can actually handle all of this logic within the add_argument method.

e.g.

self._parser.add_argument(
    ...,
    choices = ["true", "false", "auto"],
)

Copy link
Contributor Author

@apthagowda97 apthagowda97 Apr 19, 2024

Choose a reason for hiding this comment

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

This wont work because coz.. true and false should be of type Boolean.

Ref: https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/commands/download.py

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like they do the same thing as we do here: https://github.com/huggingface/huggingface_hub/blob/54e4f76594d2d8338ddccab566a9750cfe4da1bd/src/huggingface_hub/commands/download.py#L96. Just needs to be "True" and "False", rather than lowercase.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahh I missed that in the code, thanks for pointing it out. It's so gross, but seems like the best way to go forward.

Thanks for all your work on this @apthagowda97, I'll go ahead and merge!

Copy link
Contributor

@joecummings joecummings left a comment

Choose a reason for hiding this comment

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

Left a couple comments, but overall looks good! Can you also please sign the CLA?

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 19, 2024
@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

Copy link
Contributor

@joecummings joecummings left a comment

Choose a reason for hiding this comment

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

Can you install and run the linter?

@apthagowda97 apthagowda97 changed the title Added --output-dir-use-symlinks for tune download with default as False Added --output-dir-use-symlinks for tune download with default as auto Apr 20, 2024
@joecummings joecummings merged commit bfd10bc into pytorch:main Apr 22, 2024
27 checks passed
@apthagowda97 apthagowda97 deleted the use-symlinks branch April 22, 2024 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tune download has no option to set local_dir_use_symlinks
3 participants