wandb / examples

Example deep learning projects that use wandb's features.
http://wandb.ai
1.13k stars 291 forks source link

Adds simple Accelerate integration example #361

Closed tcapelle closed 1 year ago

tcapelle commented 1 year ago

Simple training script on FashionMNIST using accelerate and multiple GPUs inside a notebook.

review-notebook-app[bot] commented 1 year ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

github-actions[bot] commented 1 year ago

The following colabs where changed -colabs/huggingface/Simple_accelerate_integration_wandb.ipynb

tcapelle commented 1 year ago

this one should also be ready

morganmcg1 commented 1 year ago

looks good, probably want to have a case to avoid .log being called twice between the last train step and the validation step, so that the step counts line up. We don’t highlight that best practice enough and results in user confusion down the line

tcapelle commented 1 year ago

How would you do that? I am computing metrics on the train DL as I didn't put any validation DL. Look at the run here: https://wandb.ai/capecape/accelerate_fmnist?workspace=user-capecape What one would like is maybe having the epochs line up, but the accuracy at the start is unknown.

morganmcg1 commented 1 year ago

@tcapelle you'd need a check to see if it was at a validation step or not. It if is, then you could pass commit=False for the train metrics

tcapelle commented 1 year ago

You mean between these 2:

image

but it's ugly to pass kwargs to the accelerator:

accelerator.log({"epoch":epoch, "accuracy":accuracy}, log_kwargs={"wandb": {"commit": False}})
morganmcg1 commented 1 year ago

ugly, but the best practice way to do it

tcapelle commented 1 year ago

Ready for Review, I added that change =0