Skip to content

Commit

Permalink
review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
likholat committed Jan 23, 2025
1 parent 0d1ec0b commit b06c567
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion SUPPORTED_MODELS.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ The pipeline can work with other similar topologies produced by `optimum-intel`
<tr>
<td><code>Flux</code></td>
<td>Supported</td>
<td>Not supported</td>
<td>Supported</td>
<td>Not supported</td>
<td>
<ul>
Expand Down
14 changes: 3 additions & 11 deletions src/cpp/src/image_generation/flux_pipeline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,15 +429,6 @@ class FluxPipeline : public DiffusionPipeline {
const size_t vae_scale_factor = m_vae->get_vae_scale_factor();
const auto& transformer_config = m_transformer->get_config();

// in case of image to image generation_config_value is just ignored and computed based on initial image
if (m_pipeline_type == PipelineType::IMAGE_2_IMAGE) {
OPENVINO_ASSERT(initial_image, "Initial image is empty for image to image pipeline");
ov::Shape shape = initial_image.get_shape();
int64_t dim_val = shape[dim_idx];

generation_config_value = dim_val - (dim_val % vae_scale_factor);
}

if (generation_config_value < 0)
generation_config_value = transformer_config.m_default_sample_size * vae_scale_factor;
}
Expand All @@ -451,6 +442,9 @@ class FluxPipeline : public DiffusionPipeline {

m_generation_config = ImageGenerationConfig();

m_generation_config.height = transformer_config.m_default_sample_size * vae_scale_factor;
m_generation_config.width = transformer_config.m_default_sample_size * vae_scale_factor;

if (class_name == "FluxPipeline" || class_name == "FluxImg2ImgPipeline" || class_name == "FluxInpaintPipeline" ) {
if (m_pipeline_type == PipelineType::TEXT_2_IMAGE) {
m_generation_config.guidance_scale = 3.5f;
Expand All @@ -460,8 +454,6 @@ class FluxPipeline : public DiffusionPipeline {
m_generation_config.guidance_scale = 7.0f;
m_generation_config.num_inference_steps = 28;
m_generation_config.strength = 0.6f;
m_generation_config.height = 1024;
m_generation_config.width = 1024;
}
m_generation_config.max_sequence_length = 512;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ class FlowMatchEulerDiscreteScheduler : public IScheduler {

size_t get_begin_index() override;



private:
Config m_config;

Expand Down
3 changes: 3 additions & 0 deletions src/python/openvino_genai/py_openvino_genai.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,9 @@ class Image2ImagePipeline:
This class is used for generation with image-to-image models.
"""
@staticmethod
def flux(scheduler: Scheduler, clip_text_model: CLIPTextModel, t5_encoder_model: T5EncoderModel, transformer: FluxTransformer2DModel, vae: AutoencoderKL) -> Image2ImagePipeline:
...
@staticmethod
def latent_consistency_model(scheduler: Scheduler, clip_text_model: CLIPTextModel, unet: UNet2DConditionModel, vae: AutoencoderKL) -> Image2ImagePipeline:
...
@staticmethod
Expand Down
1 change: 1 addition & 0 deletions src/python/py_image_generation_pipelines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ void init_image_generation_pipelines(py::module_& m) {
.def_static("stable_diffusion", &ov::genai::Image2ImagePipeline::stable_diffusion, py::arg("scheduler"), py::arg("clip_text_model"), py::arg("unet"), py::arg("vae"))
.def_static("latent_consistency_model", &ov::genai::Image2ImagePipeline::latent_consistency_model, py::arg("scheduler"), py::arg("clip_text_model"), py::arg("unet"), py::arg("vae"))
.def_static("stable_diffusion_xl", &ov::genai::Image2ImagePipeline::stable_diffusion_xl, py::arg("scheduler"), py::arg("clip_text_model"), py::arg("clip_text_model_with_projection"), py::arg("unet"), py::arg("vae"))
.def_static("flux", &ov::genai::Image2ImagePipeline::flux, py::arg("scheduler"), py::arg("clip_text_model"), py::arg("t5_encoder_model"), py::arg("transformer"), py::arg("vae"))
.def(
"compile",
[](ov::genai::Image2ImagePipeline& pipe,
Expand Down
7 changes: 5 additions & 2 deletions tools/who_what_benchmark/tests/test_cli_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,11 @@ def test_image_model_types(model_id, model_type, backend):
])),
)
def test_image_model_genai(model_id, model_type):
if ("flux" in model_id or "stable-diffusion-3" in model_id) and model_type != "text-to-image":
pytest.skip(reason="FLUX or SD3 are supported as text to image only")
if ("stable-diffusion-3" in model_id) and model_type != "text-to-image":
pytest.skip(reason="SD3 is supported as text to image only")

if ("flux" in model_id) and model_type != "image-inpainting":
pytest.skip(reason="FLUX is not yet supported as image inpainting")

with tempfile.TemporaryDirectory() as temp_dir:
GT_FILE = os.path.join(temp_dir, "gt.csv")
Expand Down

0 comments on commit b06c567

Please sign in to comment.