Skip to content

enhance: support resume infer dataset from the lastest - #32

Merged
Haruko386 merged 4 commits into
mainfrom
moonshot
Jul 17, 2026
Merged

enhance: support resume infer dataset from the lastest#32
Haruko386 merged 4 commits into
mainfrom
moonshot

Conversation

@Haruko386

@Haruko386 Haruko386 commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Summary

support resume infer dataset from the lastest(only infer)

Related Issue

Related to #16

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor
  • CI / build change
  • Other

Test Results

Waitting for test on server

Summary by CodeRabbit

  • New Features
    • Added an option to resume interrupted inference runs.
    • The system now detects existing valid prediction outputs and skips them automatically.
    • If all items are already complete, the run exits early without performing additional inference.
  • Reliability Improvements
    • Predictions are saved atomically to reduce partial or corrupted outputs.
    • Missing, invalid, or empty prediction files are detected and regenerated.

@Haruko386 Haruko386 added this to the ApDepth V2-1 milestone Jul 17, 2026
@Haruko386 Haruko386 self-assigned this Jul 17, 2026
@Haruko386 Haruko386 added ✨ enhancement New feature for better experience 💫 feature New feature labels Jul 17, 2026
@Haruko386 Haruko386 moved this from Todo to Under review in @ApDepth V2-1 Jul 17, 2026
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 18ef65ba-5d30-40f8-b69d-1004b2e29584

📥 Commits

Reviewing files that changed from the base of the PR and between 0836848 and 6315d3a.

📒 Files selected for processing (1)
  • infer.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • infer.py

📝 Walkthrough

Walkthrough

Inference now supports resuming interrupted runs by validating existing .npy predictions, processing only pending dataset entries, exiting when complete, and saving outputs atomically. A new --resume_run CLI flag controls this behavior.

Changes

Resumable inference

Layer / File(s) Summary
Prediction discovery and atomic output
infer.py
Adds helpers to derive prediction paths, validate existing predictions, identify pending dataset indices, and atomically save prediction files.
Resume CLI execution flow
infer.py
Adds --resume_run, scans completed outputs, runs inference on a pending-entry Subset, exits when no work remains, and uses atomic prediction saving.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant Dataset
  participant PredictionFiles
  participant DataLoader
  CLI->>Dataset: compute pending indices
  Dataset->>PredictionFiles: validate existing predictions
  PredictionFiles-->>CLI: return pending indices
  CLI->>DataLoader: create Subset from pending indices
  DataLoader-->>CLI: provide remaining samples
  CLI->>PredictionFiles: atomically save predictions
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the main change: adding resume support for inference, even if wording is awkward.
Description check ✅ Passed The description includes all required sections from the template, with test results noted as pending.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch moonshot

Comment @coderabbitai help to get the list of available commands.

@Haruko386 Haruko386 linked an issue Jul 17, 2026 that may be closed by this pull request

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@infer.py`:
- Around line 83-88: The save_prediction_atomic function must avoid reusing the
fixed “.tmp” pathname across concurrent saves. Create a unique temporary file in
the destination directory for each save, write the NPY data to it, then
atomically replace save_to and clean up any temporary file if the operation
fails.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8a0d0a4e-894a-4365-a598-2a03bd7be03b

📥 Commits

Reviewing files that changed from the base of the PR and between 969a011 and dc1b2b2.

📒 Files selected for processing (1)
  • infer.py

Comment thread infer.py
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Note

Docstrings generation - SUCCESS
Generated docstrings for this pull request at #33

Docstrings generation was requested by @Haruko386.

* #32 (comment)

The following files were modified:

* `infer.py`
Removed commented-out code for UNet2DConditionModel instantiation.

@Haruko386 Haruko386 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Haruko386
Haruko386 merged commit 9033399 into main Jul 17, 2026
5 checks passed
@github-project-automation github-project-automation Bot moved this from Under review to Done in @ApDepth V2-1 Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ enhancement New feature for better experience 💫 feature New feature

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Feature] resume infer/eval on datasets from checkpoint

1 participant