forked from openvinotoolkit/openvino.genai
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update for LoRA Adapters: Derived adapters and support for FLUX (open…
…vinotoolkit#1602) Introducing the concept of a "derived" adapter that allows the creation of pipeline-dependent LoRA naming conventions to original Safetensors adapters, but in a way that is hidden from the user. So, the user continues using original Adapter objects to identify adapters, but internally they are wrapped by "derived" adapter that consists of two parts: (1) original Adapter reference which plays a role of unique adapter identifier, and (2) a postponed derivation action that is applied only once when transformed Adapter tensors are required for the first time. Applied different derivations for SD/SDXL and FLUX. Three naming conventions work for FLUX: original diffusers, Kohya, and XLabs. Still missing: BFL. Other changes: - Ignore the original generation config in LoRA LLMPipeline sample to align with the base greedy sample. - Fix ProgressBar when it is used for the second time which takes place in text2image LoRA sample - Introduce `SharedOptional` class to simplify the code of conditional property modifications based on adapters present and maintain the same copy-on-modify behavior when properties are not replicated when it is not needed. - Split code of LoRA adapters to more files for better readability. - Shorten required prefix for LLM's LoRA to be compatible with a wider set of adapters.
- Loading branch information
Showing
24 changed files
with
764 additions
and
199 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,34 @@ | ||
// Copyright (C) 2023-2025 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#include <optional> | ||
|
||
#include "indicators/progress_bar.hpp" | ||
|
||
bool progress_bar(size_t step, size_t num_steps, ov::Tensor& /* latent */) { | ||
using namespace indicators; | ||
|
||
static ProgressBar bar{ | ||
option::BarWidth{50}, | ||
option::ForegroundColor{Color::green}, | ||
option::FontStyles{std::vector<FontStyle>{FontStyle::bold}}, | ||
option::ShowElapsedTime{true}, | ||
option::ShowRemainingTime{true}, | ||
}; | ||
static std::optional<ProgressBar> bar; | ||
|
||
if (!bar) { | ||
bar.emplace( | ||
option::BarWidth{50}, | ||
option::ForegroundColor{Color::green}, | ||
option::FontStyles{std::vector<FontStyle>{FontStyle::bold}}, | ||
option::ShowElapsedTime{true}, | ||
option::ShowRemainingTime{true} | ||
); | ||
} | ||
|
||
std::stringstream stream; | ||
stream << "Image generation step " << (step + 1) << " / " << num_steps; | ||
|
||
bar.set_option(option::PostfixText{stream.str()}); | ||
bar.set_progress((100 * (step + 1)) / num_steps); | ||
bar->set_option(option::PostfixText{stream.str()}); | ||
bar->set_progress((100 * (step + 1)) / num_steps); | ||
|
||
if (step + 1 == num_steps) { | ||
bar.reset(); // Required when multiple progress bars are used, without recreation of the object the second progress bar won't be displayed correctly | ||
} | ||
|
||
return false; | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.