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

Create HF repo if it doesn't exist #607

Merged
merged 1 commit into from
Jun 1, 2024

Conversation

versae
Copy link
Contributor

@versae versae commented May 31, 2024

The HFCheckpointConverter.save_pretrained() function needs an existing repo for the push to HF to be successful. This PR checks whether the repo already exists, and if not, it creates a private one so the training doesn't fail because of the push to HF failed.

Feel free to ignore if the functionality is not desired.

@@ -757,6 +759,9 @@ def save_pretrained(
upload_to_hf = self.reference_checkpoint
if not isinstance(upload_to_hf, bool):
assert isinstance(upload_to_hf, (str, RepoRef))
if isinstance(upload_to_hf, str) and not repo_exists(upload_to_hf, repo_type="model"):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I assume a RepoRef can only exist when an actual repo also exists in HF.

Copy link
Member

Choose a reason for hiding this comment

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

makes sense to me!

Copy link
Member

@dlwh dlwh left a comment

Choose a reason for hiding this comment

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

Thanks!

@dlwh dlwh merged commit 9adba01 into stanford-crfm:main Jun 1, 2024
1 check failed
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.

2 participants