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

support pathlib.Path paths in lightning API #15497

Closed
dyollb opened this issue Nov 3, 2022 · 1 comment · Fixed by #15560
Closed

support pathlib.Path paths in lightning API #15497

dyollb opened this issue Nov 3, 2022 · 1 comment · Fixed by #15560
Labels
code quality feature Is an improvement or enhancement
Milestone

Comments

@dyollb
Copy link
Contributor

dyollb commented Nov 3, 2022

Proposed refactor

It would be nice if the api would support pathlib.Path paths.

methods like

  • load_from_checkpoint
  • save_checkpoint

and variables like

  • default_root_dir (in Trainer)

Motivation

  • pathlib.Path paths are concise, e.g. root_dir / "model.pt"
  • this could be done via e.g. a Union[str, Path] or similar.

Pitch

Additional context


If you enjoy Lightning, check out our other projects! ⚡

  • Metrics: Machine learning metrics for distributed, scalable PyTorch applications.

  • Lite: enables pure PyTorch users to scale their existing code on any kind of device while retaining full control over their own loops and optimization logic.

  • Flash: The fastest way to get a Lightning baseline! A collection of tasks for fast prototyping, baselining, fine-tuning, and solving problems with deep learning.

  • Bolts: Pretrained SOTA Deep Learning models, callbacks, and more for research and production with PyTorch Lightning and PyTorch.

  • Lightning Transformers: Flexible interface for high-performance research using SOTA Transformers leveraging PyTorch Lightning, Transformers, and Hydra.

cc @Borda

@dyollb dyollb added the needs triage Waiting to be triaged by maintainers label Nov 3, 2022
@awaelchli awaelchli added feature Is an improvement or enhancement code quality and removed needs triage Waiting to be triaged by maintainers labels Nov 4, 2022
@awaelchli
Copy link
Contributor

@dyollb Thanks for noticing this! We actually do support it 🎉 . load_from_checkpoint just needs a tiny update in the type annotation. See my changes in #15540 .
Trainer.save_checkpoint also supports it today.

Would you be interested in looking into Trainer.default_root_dir? Everything should be working there too, just needs a type update in the Trainer argument.

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

Successfully merging a pull request may close this issue.

3 participants