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

text2image: Add pimp approach for unet_2d_condition & batch-size 1 implementation of unet for initial NPU support #1101

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

RyanMetcalfeInt8
Copy link

For now, NPU can be used like this. The unet model must be reshaped to a static shape before compile is invoked.

std::filesystem::path root_dir = models_path;
auto pipe = ov::genai::Text2ImagePipeline::stable_diffusion(
    ov::genai::Text2ImagePipeline::Scheduler::from_config(root_dir / "scheduler/scheduler_config.json"),
    ov::genai::CLIPTextModel(root_dir / "text_encoder", "CPU"),
    ov::genai::UNet2DConditionModel(root_dir / "unet")
        .reshape(2, 512, 512, 77)
        .compile("NPU", ov::cache_dir("./cache")),
    ov::genai::AutoencoderKL(root_dir / "vae_decoder", "GPU", ov::cache_dir("./cache")));
ov::Tensor image = pipe.generate(prompt);

@github-actions github-actions bot added category: text to image Text 2 image pipeline category: sampling Sampling / Decoding algorithms category: GenAI C++ API Changes in GenAI C++ public headers labels Oct 29, 2024
@andrei-kochin andrei-kochin requested review from likholat, ilya-lavrenov and Wovchena and removed request for likholat October 29, 2024 14:55
@RyanMetcalfeInt8
Copy link
Author

Rebased against latest master branch (resolved text2image -> image_generation move, etc.). @TolyaTalamanov, @ilya-lavrenov, can someone help review?

@ilya-lavrenov ilya-lavrenov self-assigned this Nov 5, 2024
@ilya-lavrenov ilya-lavrenov removed the category: sampling Sampling / Decoding algorithms label Nov 5, 2024
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: text to image Text 2 image pipeline
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants