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

Shorthand way to grab a tracker #594

Merged
merged 9 commits into from
Aug 2, 2022
Merged

Shorthand way to grab a tracker #594

merged 9 commits into from
Aug 2, 2022

Conversation

muellerzr
Copy link
Collaborator

@muellerzr muellerzr commented Aug 2, 2022

Shorthand way to grab a tracker

What does this add?

This PR introduces a method to the Accelerator that lets you grab a tracker's internal run if some custom code with it is wanted to be ran

Who is it for?

Closes #592

Why is it needed?

There are needs when using wandb for example to access and toy with the run, such as stated in #592. Currently you need to index into the trackers, hope you find the right one, and then in the case of wandb call run.run which is a bit convoluted.

What parts of the API does this impact?

User-facing:

Adds a new Accelerator.get_tracker method. To get a tracker you should pass in the corresponding string to the .name attribute

Internal structure:

Trackers now have a new abstract property of tracker which should be used to return the internal tracking mechanism normal users would expect to interact with.

Basic Usage Example(s):

accelerator = Accelerator(log_with="wandb")

accelerator.init_trackers("my_project_name")

if accelerator.is_main_process:
    wandb_run = accelerator.get_tracker('wandb')
    wandb_run.log_artifact(test_data_at_xyz)

When would I use it, and when wouldn't I?

When custom interactions with a tracker is wanted.

@muellerzr muellerzr added the enhancement New feature or request label Aug 2, 2022
@muellerzr muellerzr requested a review from sgugger August 2, 2022 12:29
Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

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

Thanks for adding this!

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Aug 2, 2022

The documentation is not available anymore as the PR was closed or merged.

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

Successfully merging this pull request may close these issues.

How to use data visualization API with accelerate.tracking?
3 participants