-
Notifications
You must be signed in to change notification settings - Fork 188
feat: Add Stability AI Inpainting v2 block with local and cloud execution modes #1366
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
Draft
yeldarby
wants to merge
13
commits into
main
Choose a base branch
from
feat/stability-ai-inpainting-v2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
yeldarby
commented
Jun 17, 2025
- Create v2 of the Stability AI Inpainting block that supports both cloud API and local execution
- Add dropdown to switch between 'Run Locally' and 'Run via Stability AI Cloud' (default: cloud)
- Cloud mode functions identically to v1 with required API key
- Local mode uses Stable Diffusion Inpainting v1.5 via HuggingFace diffusers
- Add optional parameters for local mode: num_inference_steps, guidance_scale, seed
- Maintain backward compatibility with v1 input/output formats
- Add diffusers to transformers requirements
- Add comprehensive documentation and unit tests
- Register block in loader while keeping v1 untouched
…tion modes - Create v2 of the Stability AI Inpainting block that supports both cloud API and local execution - Add dropdown to switch between 'Run Locally' and 'Run via Stability AI Cloud' (default: cloud) - Cloud mode functions identically to v1 with required API key - Local mode uses Stable Diffusion Inpainting v1.5 via HuggingFace diffusers - Add optional parameters for local mode: num_inference_steps, guidance_scale, seed - Maintain backward compatibility with v1 input/output formats - Add diffusers to transformers requirements - Add comprehensive documentation and unit tests - Register block in loader while keeping v1 untouched
tests/workflows/unit_tests/core_steps/models/foundation/stability_ai/inpainting/test_v2.py
Fixed
Show fixed
Hide fixed
- Replace MaskAnnotator with direct mask manipulation to avoid class_id requirement - Move API key validation from manifest to run method - Update tests to reflect the validation changes - Add name field to test manifests as required by WorkflowBlockManifest
- Add required parent_metadata argument to WorkflowImageData in test_cloud_inference
- Add pipeline caching to avoid reloading model on each inference - Add init parameters for proper workflow block initialization - Improve error messages for missing model files - Add use_safetensors=True for better compatibility - Add progress logging when loading the model
- Use module-level caching for Stable Diffusion pipeline to match other models - Store models in MODEL_CACHE_DIR for consistency - Add proper logging with inference logger - Use torch.inference_mode() for better performance - Remove complex model manager integration (to be added when loading from Roboflow backend) - Keep implementation simple and focused on functionality
- Switch from discontinued runwayml/stable-diffusion-inpainting to stable-diffusion-v1-5/stable-diffusion-inpainting - Add variant='fp16' parameter to load model.fp16.safetensors correctly - Update documentation to reflect the correct model repository - The new repository contains the actual model weights needed for inference
- The stable-diffusion-v1-5/stable-diffusion-inpainting repo only contains .fp16.safetensors files - Remove conditional variant selection and always use variant='fp16' - This fixes the 'diffusion_pytorch_model.safetensors not found' error - Simplify the loading logic and improve error messages
…ng sanitization Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Ported recent changes made to v1 - |
grzegorz-roboflow
approved these changes
Jun 23, 2025
@grzegorz-roboflow please do not merge this draft; using it to work w/ a hardware partner on testing some things. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.