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

[Train] Convert All doc tests and examples to use new Checkpoint API #38859

Conversation

woshiyyya
Copy link
Member

@woshiyyya woshiyyya commented Aug 24, 2023

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 -> TorchTrainer
  • doc/source/ray-air/examples/dolly_lightning_fsdp_finetuning.ipynb: Fix release test
  • depends on [train] remove preprocessor logic for XGBoost/LightGBM Trainers #38866
    • doc/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

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Signed-off-by: woshiyyya <xiaoyunxuan1998@gmail.com>
Signed-off-by: woshiyyya <xiaoyunxuan1998@gmail.com>
Signed-off-by: woshiyyya <xiaoyunxuan1998@gmail.com>
Signed-off-by: woshiyyya <xiaoyunxuan1998@gmail.com>
Copy link
Contributor

@justinvyu justinvyu left a 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:

doc/source/tune/doc_code/fault_tolerance.py Outdated Show resolved Hide resolved
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")
Copy link
Contributor

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?

Copy link
Contributor

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 😅

Copy link
Member Author

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",
Copy link
Contributor

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)

Co-authored-by: Justin Yu <justinvyu@anyscale.com>
Signed-off-by: Yunxuan Xiao <xiaoyunxuan1998@gmail.com>
@woshiyyya woshiyyya closed this Aug 28, 2023
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.

4 participants