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

feat: add artifact id and token endpoint #485

Merged
merged 8 commits into from
Jul 13, 2022
Merged

Conversation

bwanglzu
Copy link
Member

@bwanglzu bwanglzu commented Jul 13, 2022

This PR allows user to get user token from Hubble, and get artifact id once fine-tuning is done. Usage:

import finetuner

finetuner.login()
token = finetuner.get_token()

run = finetuner.get_run(run_name='something')
artifact_id = run.artifact_id

This allows user to directly pull artifact inside FinetunerExecutor usingtoken and artifact as artifact_id.
This PR also did some minor refactoring on download_artifact and error handling.

A follow up PR will be created to update documentation including the usage of FinetunerExecutor.


  • This PR references an open issue
  • I have added a line about this change to CHANGELOG

@github-actions github-actions bot added area/entrypoint area/testing This issue/PR affects testing labels Jul 13, 2022
@bwanglzu bwanglzu marked this pull request as ready for review July 13, 2022 10:30
def get_token() -> str:
"""Get user token.

This is a helper function to get token and pull artifact from cloud storage.
Copy link
Member

Choose a reason for hiding this comment

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

the docstring is confusing. This function does not download the artifact

...


class UserNotLoginError(Exception):
Copy link
Member

Choose a reason for hiding this comment

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

UserNotLoggedIn

finetuner/run.py Outdated
status = self.status()[STATUS]
if status in [CREATED, STARTED]:
raise RunInProgressError(
'The run needs to be finished in order to save the model.'
Copy link
Member

Choose a reason for hiding this comment

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

save the artifact

run_name=self._name,
directory=directory,
)

def artifact_id(self):
Copy link
Member

Choose a reason for hiding this comment

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

this should be a property. Otherwise rename to get_artifact_id

Copy link
Member Author

Choose a reason for hiding this comment

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

how about staus()?

Copy link
Member

Choose a reason for hiding this comment

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

well I think all should be properties 😛

Copy link
Member Author

Choose a reason for hiding this comment

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

i believe status() and logs() should be get_, the rest could be property

Copy link
Member

Choose a reason for hiding this comment

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

having static ones as properties and non-statics with get_ makes sense to me, but I'm slightly leaning towards what George suggested because it looks simpler and more elegant

Copy link
Member

@jupyterjazz jupyterjazz left a comment

Choose a reason for hiding this comment

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

LGTM!

run_name=self._name,
directory=directory,
)

def artifact_id(self):
Copy link
Member

Choose a reason for hiding this comment

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

having static ones as properties and non-statics with get_ makes sense to me, but I'm slightly leaning towards what George suggested because it looks simpler and more elegant

@bwanglzu bwanglzu merged commit ae0bc8f into main Jul 13, 2022
@bwanglzu bwanglzu deleted the feat-improve-usability branch July 13, 2022 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants