Lightning-AI / Lightning-AI/pytorch-lightning

Support IO Type Checkpoints for trainer.fit() in ckpt_path Parameter

Open
#20,189 0 comments 0 reactions 0 assignees View on GitHub
checkpointing feature
Dominant language
Python
Stars
31.4k
Forks
3.8k
Avg merge
6d 7h
Merged PRs (30d)
6

Description

### Description & Motivation

Currently, PyTorch Lightning supports loading checkpoints using model.load_from_checkpoint(checkpoint_path) where the checkpoint_path parameter can accept IO types. This flexibility is very useful in scenarios where checkpoints are stored in non-standard storage systems (e.g., cloud storage, in-memory storage, etc.).

However, when resuming training with the trainer.fit() method, the ckpt_path parameter does not support IO types. This limitation restricts users to using string paths only, which may not be feasible in all environments.

### Pitch

_No response_

### Alternatives

Extend the functionality of the ckpt_path parameter in the trainer.fit() method to also accept IO types, similar to how load_from_checkpoint() operates. This would involve modifying the internal logic of trainer.fit() to handle IO types appropriately, ensuring consistency with the load_from_checkpoint() method.

### Additional context

_No response_

cc @lantiga @borda

Contributor guide

Open the contributing guide

Research direction

Compare the trainer.fit() ckpt_path handling with model.load_from_checkpoint(checkpoint_path), which the issue identifies as the working reference. Trace the checkpoint-loading entry point and locate tests covering both paths; done means trainer.fit() accepts the same IO types without breaking string-path resume behavior and the relevant tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.