Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends OVMS image-generation support to cover inpainting/outpainting via the OpenAI-compatible /v3/images/edits endpoint (using an uploaded mask), and updates pipeline initialization to include OpenVINO GenAI’s InpaintingPipeline.
Changes:
- Add
InpaintingPipelineto the image-generation pipeline bundle and initialize pipelines with weight-sharing + fallbacks. - Route
/v3/images/editsrequests to inpainting whenmaskis provided; expand request-option validation to acceptmask. - Extend multipart parser interface with a “files array” accessor and update demos/docs/assets accordingly.
Reviewed changes
Copilot reviewed 13 out of 20 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
src/image_gen/http_image_gen_calculator.cc |
Routes edit requests to inpainting when mask is present; removes per-request pipeline cloning. |
src/image_gen/pipelines.hpp |
Adds InpaintingPipeline member and include. |
src/image_gen/pipelines.cpp |
Builds/compiles inpainting pipeline and derives other pipelines with fallbacks. |
src/image_gen/imagegenutils.cpp |
Accepts mask in allowed fields for generation/edit option parsing. |
src/multi_part_parser.hpp |
Adds getFilesArrayByFieldName() to the multipart parser API. |
src/http_frontend/multi_part_parser_drogon_impl.hpp/.cpp |
Implements getFilesArrayByFieldName() for Drogon multipart parser. |
src/test/text2image_test.cpp |
Updates MockedMultiPartParser to match the new interface. |
src/test/test_http_utils.hpp |
Updates multipart parser mock to match the new interface. |
src/test/pull_hf_model_test.cpp |
Adds test coverage for image-generation export command with extra params. |
src/pull_module/optimum_export.cpp |
Appends extraQuantizationParams for image-generation export command. |
demos/image_generation/README.md |
Documents inpainting/outpainting usage via cURL and OpenAI Python client. |
demos/image_generation/cat_mask.png |
Demo asset for inpainting mask. |
demos/image_generation/outpaint_mask.png |
Demo asset for outpainting mask. |
.gitignore |
Reorders/adds Bazel output directories to ignore list. |
.dockerignore |
Expands ignored local/dev and build artifacts; ignores models/ and logs. |
You can also share your feedback on Copilot code review. Take the survey.
mask field should only be accepted in image edit (inpainting) requests, not in text-to-image generation requests.
|   | ||
|
|
||
| Linux | ||
| ```bash |
There was a problem hiding this comment.
Add tab for sphinx? Can you generate sphinx doc so we can see how it is going to look? @atobiszei
demos/image_generation/README.md
Outdated
|
|
||
|   | ||
|
|
||
| Linux |
There was a problem hiding this comment.
Follow switch formating with sphinx, as in earlier part of readme.
src/pull_module/optimum_export.cpp
Outdated
| oss << " --weight-format " << this->exportSettings.precision; | ||
| if (this->exportSettings.extraQuantizationParams.has_value()) { | ||
| oss << " " << this->exportSettings.extraQuantizationParams.value(); | ||
| } // TODO FIXME check if its not needed to propagate to other exports |
There was a problem hiding this comment.
who is going to do this? FIXME are treated as errors during release
…s and demo review update
c818d8b to
eac3932
Compare
There was a problem hiding this comment.
Pull request overview
Adds OpenAI-compatible image edit support (image-to-image + inpainting/outpainting) to OVMS image generation, extends multipart parsing, and propagates Optimum export extra quantization parameters across tasks. This fits into the image generation REST API surface (/v3/images/*) and the HF pull/export flow.
Changes:
- Add inpainting routing for
/v3/images/editswhen amaskmultipart file is provided, including pipeline initialization and request serialization. - Extend multipart parser interface to support arrays of file parts; add unit tests for edits option validation (including
mask). - Propagate
extraQuantizationParamsinto additional Optimum export command builders and update related tests; refresh demo docs/assets.
Reviewed changes
Copilot reviewed 14 out of 21 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/text2image_test.cpp | Adds unit tests around /v3/images/edits request-option validation (mask accepted, unknown/rejected fields, defaults, bounds). |
| src/test/test_http_utils.hpp | Updates multipart parser mock with new getFilesArrayByFieldName() API. |
| src/test/pull_hf_model_test.cpp | Updates expected Optimum export commands to include extra quantization params; adds image-gen specific coverage. |
| src/pull_module/optimum_export.cpp | Appends extraQuantizationParams to additional Optimum export command builders (embeddings/TTS/STT/rerank/image-gen). |
| src/multi_part_parser.hpp | Extends multipart parser interface with getFilesArrayByFieldName(). |
| src/image_gen/pipelines.hpp | Adds inpainting pipeline + queue serialization guard for inpainting requests. |
| src/image_gen/pipelines.cpp | Builds pipeline chain with fallbacks and initializes single-slot queue for inpainting serialization. |
| src/image_gen/imagegenutils.cpp | Treats mask as an accepted multipart field for edits. |
| src/image_gen/http_image_gen_calculator.cc | Routes /v3/images/edits to inpainting when mask is present; adds pipeline availability checks and queue-guarded execution. |
| src/image_gen/BUILD | Adds dependency on //src:libovms_queue for inpainting serialization. |
| src/http_frontend/multi_part_parser_drogon_impl.hpp | Declares new getFilesArrayByFieldName() implementation. |
| src/http_frontend/multi_part_parser_drogon_impl.cpp | Implements getFilesArrayByFieldName() using Drogon parser’s files list. |
| demos/image_generation/outpaint_mask.png | Adds demo asset for outpainting mask example. |
| demos/image_generation/cat_mask.png | Adds demo asset for inpainting mask example. |
| demos/image_generation/README.md | Documents inpainting/outpainting usage and updates model-status endpoint example. |
| .gitignore | Adjusts Bazel output ignore entries. |
| .dockerignore | Expands ignored dev/build artifacts to reduce Docker build context size. |
You can also share your feedback on Copilot code review. Take the survey.
src/image_gen/pipelines.hpp
Outdated
| InpaintingQueueGuard(Queue<int>& queue, std::chrono::seconds timeout) : | ||
| queue_(queue) { | ||
| auto future = queue_.getIdleStream(); | ||
| if (future.wait_for(timeout) == std::future_status::ready) { | ||
| streamId_ = future.get(); | ||
| acquired_ = true; | ||
| } | ||
| } |
| // Serializes concurrent inpainting requests (InpaintingPipeline lacks clone()). | ||
| // Queue size = 1: only one inpainting inference runs at a time. | ||
| std::unique_ptr<Queue<int>> inpaintingQueue; | ||
| static constexpr std::chrono::seconds DEFAULT_INPAINTING_TIMEOUT{300}; // 5 minutes | ||
|
|
| // API for MP calculators to get the multipart file content by field name. | ||
| // Returns empty string if file is not found. | ||
| virtual std::string_view getFileContentByFieldName(const std::string& name) const = 0; | ||
|
|
||
| // API for MP calculators to get all file contents for a given array field name (e.g. "image[]"). | ||
| virtual std::vector<std::string_view> getFilesArrayByFieldName(const std::string& name) const = 0; |
| ov::Tensor maskTensor; | ||
| SPDLOG_LOGGER_DEBUG(llm_calculator_logger, "ImageGenCalculator [Node: {}] Inpainting: decoding mask tensor", cc->NodeName()); | ||
| status = makeTensorFromString(std::string(mask.value()), maskTensor); | ||
| if (!status.ok()) { |
…n, fix docs and includes
Ticket:CVS-181770