Skip to content

feat: support Fibo2 native masked reference editing - #2215

Open
losewayy wants to merge 1 commit into
leejet:masterfrom
losewayy:codex/fibo2-mask
Open

losewayy wants to merge 1 commit into
leejet:masterfrom
losewayy:codex/fibo2-mask

Conversation

@losewayy

@losewayy losewayy commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add Fibo2 native masked editing through the existing -r and --mask options. Apply the mask to the source reference image before the existing crop, resize, VAE and vision-encoder preprocessing, matching the Diffusers implementation.

Document the mask requirements and its behavior when an initial image is also supplied.

Related Issue / Discussion

Extends Fibo 2.0 support from #2180.

Additional Information

  • Built the CUDA CLI and server on Windows.
  • Ran Fibo2 Dev INT8 convrot editing at 256x256 with Euler, four steps and seed 42. Native masking and a manually gray-filled reference produced pixel-identical outputs.
  • Confirmed unmasked generation is pixel-identical to the baseline.

Checklist

Summary by CodeRabbit

  • New Features
    • Fibo 2.0 masked reference editing supports one reference image and a same-size mask. Mask values of 128 or higher select pixels, which are filled with gray before processing.
    • When both a reference image and an initial image are provided, the mask applies to the reference; the initial image remains the image-to-image starting point.
  • Documentation
    • Clarified reference-mask requirements and how this behavior differs from latent denoising masks and existing initial-image masking.

@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0f3b8135-65dd-40df-91f6-c5b7b04b1f72
Commits

Reviewing files that changed from the base of the PR and between 012c7f8 and 3c7722c.

Files selected for processing: 2
  • docs/fibo2.md
  • src/pipeline/image.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.

Walkthrough

FIBO2 image generation now preprocesses a supplied mask into a reference image before input preprocessing. The helper validates the reference and mask inputs. Documentation describes thresholding, pixel fill, and behavior when --init-img is supplied.

Changes: FIBO2 Masked Reference Editing

Layer / File(s) Summary
Masked reference preprocessing
src/pipeline/image.cpp, docs/fibo2.md
FIBO2 generation validates the reference and mask, builds an RGB reference with selected pixels filled, and clears the mask before input preprocessing. The documentation describes the threshold and interaction with --init-img.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant generate_image
  participant prepare_fibo2_mask
  participant prepare_inputs
  generate_image->>prepare_fibo2_mask: prepare FIBO2 masked reference
  prepare_fibo2_mask-->>generate_image: replace reference and clear mask
  generate_image->>prepare_inputs: prepare image inputs
Loading

Possibly related PRs

Suggested reviewers: leejet

Merge Risk: Minimal · up to 3c772

The documented masked-reference behavior is consistent with the described implementation. The change is mergeable after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 1 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: adding native masked reference editing for Fibo2.
Description check Passed The description includes all required sections and provides clear implementation details, related work, verification results, and a completed checklist.
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 1 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

🔧 Cppcheck (2.22.0)
src/pipeline/image.cpp

Cppcheck timed out; analysis of this file is incomplete

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@losewayy

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
✅ Action performed

Full review finished.

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.

1 participant