-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
[Train] Convert All doc tests and examples to use new Checkpoint API #38859
[Train] Convert All doc tests and examples to use new Checkpoint API #38859
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this is good progress!!
Btw, PBT is not landed yet so it's causing some errors. Also some issues I saw:
model_state=net.state_dict(), | ||
optimizer_state=optimizer.state_dict(), | ||
epoch=epoch, | ||
) | ||
) | ||
train.report(dict(loss=running_loss / epoch_steps), checkpoint=checkpoint) | ||
torch.save(state_dict, f"{tmpdir}/checkpoint.bin") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we only use os.path.join
for all examples?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hopefully that's easy to do with find and replace 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh ok. Let me replace them,
"\n", | ||
"checkpoint = LegacyTransformersCheckpoint.from_checkpoint(result.checkpoint)\n", | ||
"checkpoint = TransformersCheckpoint.from_checkpoint(result.checkpoint)\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be TransformersCheckpoint(path=result.checkpoint.path, filesystem=result.checkpoint.filesystem)
doc/source/ray-air/examples/huggingface_text_classification.ipynb
Outdated
Show resolved
Hide resolved
Co-authored-by: Justin Yu <justinvyu@anyscale.com> Signed-off-by: Yunxuan Xiao <xiaoyunxuan1998@gmail.com>
Why are these changes needed?
Convert most Ray Train/AIR/Tune examples and doc code to use new Checkpoint API.
We need to fix the rest in the following PR:
doc/source/train/examples/lightning/lightning_cola_advanced.ipynb
: LightningTrainer -> TorchTrainerdoc/source/ray-air/examples/dolly_lightning_fsdp_finetuning.ipynb
: Fix release testdoc/source/ray-air/examples/lightgbm_example.ipynb
doc/source/ray-air/examples/xgboost_example.ipynb
doc/source/tune/examples/tune_analyze_results.ipynb
Related issue number
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/
under thecorresponding
.rst
file.