Skip to content

Commit

Permalink
Minor corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
v-Golubev committed Oct 16, 2024
1 parent 8298706 commit 22f795a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/common/transformations/include/ov_ops/lora_subgraph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ namespace internal {
* @brief LoraSubgraph operation, which is used for LoRA subgraphs fusion.
* It always has only 1 output, and the following inputs, whose order is fixed:
* 1. main_flow_input: input from original model.
* 2. LoRA_input: input to which the Low-Rank adaptation is applied. The adapted input is combined with `main_flow_input`.
* 2. LoRA_input: input to which the Low-Rank adaptation is applied.
* The adapted input is combined with `main_flow_input`.
* 3. LoRA_matrices: 3 Low-Rank adaptation matrices applied to `LoRA_input`.
* The fused subgraph can be optimized in runtime based on LoRA semantic.
* For instance, `main_flow_input` can be fast-forwarded to output in case of empty `LoRA_matrices`.
Expand Down
4 changes: 4 additions & 0 deletions src/common/transformations/src/ov_ops/lora_subgraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "ov_ops/lora_subgraph.hpp"

#include "itt.hpp"

namespace ov {
namespace op {
namespace internal {
Expand All @@ -18,11 +20,13 @@ LoraSubgraph::LoraSubgraph(const OutputVector& args, const std::shared_ptr<ov::M
}

std::shared_ptr<Node> LoraSubgraph::clone_with_new_inputs(const OutputVector& new_args) const {
INTERNAL_OP_SCOPE(internal_LoraSubgraph_clone_with_new_inputs);
check_new_args_count(this, new_args);
return std::make_shared<LoraSubgraph>(new_args, get_function()->clone());
}

void LoraSubgraph::validate_and_infer_types() {
INTERNAL_OP_SCOPE(internal_LoraSubgraph_validate_and_infer_types);
OPENVINO_ASSERT(get_input_size() == 5, "LoraSubgraph must have 5 inputs whereas it has ", get_input_size());
OPENVINO_ASSERT(get_output_size() == 1, "LoraSubgraph must have 1 output whereas it has ", get_output_size());
const auto& body = get_function();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ ov::pass::LoraSubgraphFusion::LoraSubgraphFusion() {

// Note: internal_inputs/external_connections order corresponds to LoraSubgraph semantic
const std::vector<ov::Input<ov::Node>> internal_inputs{
find_connected_input(add.get_node(), main_flow.get_node()),
// For commutative eltwise ops, input idx may be any, so it must be computed
find_connected_input(add.get_node(), main_flow.get_node()),
pattern_map.count(transpose1_m) ? pattern_map.at(transpose1_m).get_node()->input(0)
: matmul1.get_node()->input(0),
matmul1.get_node()->input(1),
Expand Down

0 comments on commit 22f795a

Please sign in to comment.