lightly-ai / lightly-ai/lightly

ImageNet benchmark runs can't cleanly resume: no last.ckpt + timestamped run dirs

Open
#2,053 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement good first issue
Dominant language
Python
Stars
3.8k
Forks
367
Avg merge
3d 22h
Merged PRs (30d)
5

Description

`--ckpt-path` already flows into `trainer.fit(ckpt_path=...)` (`benchmarks/imagenet/resnet50/main.py:323`, `benchmarks/imagenet/vitb16/main.py:269`), so Lightning restores epoch, optimizer and scheduler state. Two gaps stop it being a clean resume.

**1. No explicit `ModelCheckpoint`.** The `pretrain()` callback lists (`resnet50/main.py:306`, `vitb16/main.py:252`) rely on Lightning's implicit epoch-end checkpoint. No `last.ckpt`, no mid-epoch save, no retention control for 100-epoch runs.

**2. Every launch stamps a fresh run dir** with `datetime.now()` (`resnet50/main.py:122`, `vitb16/main.py:103`). A resume logs to a new folder and there is no discovery of the prior checkpoint, so you hand-locate the `.ckpt` path.

**Scope** (benchmark-only, both `main.py`):
- [ ] Add `ModelCheckpoint(save_last=True, ...)` to both `pretrain()` callback lists.
- [ ] Add `--resume` that resolves the newest run dir + its `last.ckpt` and reuses that dir instead of stamping a new one.
- [ ] Pass the resolved path to `ckpt_path`.
- [ ] Document the flag in `benchmarks/imagenet/README.md`.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read benchmarks/imagenet/resnet50/main.py and vitb16/main.py around pretrain(), the callback lists, and the timestamped run-directory setup. Trace how --ckpt-path reaches trainer.fit, then implement and verify --resume uses the newest run directory and last.ckpt for both benchmarks. Update benchmarks/imagenet/README.md to document the flag and expected resume behavior.

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
Active
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.