Skip to content
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

Callback for Text2Image Pipeline, Flux pipeline fix #1223

Merged
merged 6 commits into from
Nov 20, 2024

Conversation

likholat
Copy link
Contributor

@likholat likholat commented Nov 18, 2024

Callback sample with decoding:

auto callback = [&](size_t step, ov::Tensor& intermediate_res) -> bool {
      std::cout << "Image generation step: " << step << std::endl;
      if (step == 9) {
          ov::Tensor img = pipe.decode(intermediate_res);
          imwrite("callback_image_%d.bmp", img, true);
          return true;
      }
      return false;
  };

@github-actions github-actions bot added category: text to image Text 2 image pipeline category: sampling Sampling / Decoding algorithms category: Python API Python API for GenAI category: samples GenAI samples category: GenAI C++ API Changes in GenAI C++ public headers labels Nov 18, 2024
@likholat likholat force-pushed the callback_txt2img branch 3 times, most recently from 8ab70eb to 4b3e0b6 Compare November 18, 2024 13:35
@likholat likholat marked this pull request as ready for review November 18, 2024 17:15
@ilya-lavrenov ilya-lavrenov added this to the 2025.0 milestone Nov 19, 2024
@ilya-lavrenov ilya-lavrenov added port to LTS PR needs to be ported to LTS and removed category: sampling Sampling / Decoding algorithms labels Nov 19, 2024
@github-actions github-actions bot added the category: sampling Sampling / Decoding algorithms label Nov 19, 2024
@ilya-lavrenov ilya-lavrenov removed the port to LTS PR needs to be ported to LTS label Nov 19, 2024
(text2image_generate_docstring + std::string(" \n ")).c_str()
);
(text2image_generate_docstring + std::string(" \n ")).c_str())
.def("decode", &ov::genai::Text2ImagePipeline::decode, py::arg("latent"));;
Copy link
Collaborator

Choose a reason for hiding this comment

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

is there any plans also demonstrate decode method usage somewhere in readme?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ilya-lavrenov ilya-lavrenov added this pull request to the merge queue Nov 20, 2024
@ilya-lavrenov ilya-lavrenov removed the category: sampling Sampling / Decoding algorithms label Nov 20, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 20, 2024
@ilya-lavrenov ilya-lavrenov added this pull request to the merge queue Nov 20, 2024
Merged via the queue into openvinotoolkit:master with commit 40c249d Nov 20, 2024
52 checks passed
}

latents = unpack_latents(latents, generation_config.height, generation_config.width, vae_scale_factor);
return m_vae->decode(latents);
}

ov::Tensor decode(const ov::Tensor latent) override {
Copy link
Contributor

Choose a reason for hiding this comment

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

looks like it should also perform unpack_latents ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: GenAI C++ API Changes in GenAI C++ public headers category: Python API Python API for GenAI category: samples GenAI samples category: text to image Text 2 image pipeline
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants