-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eb44c6e
commit 400e41c
Showing
5 changed files
with
56 additions
and
56 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (C) 2023-2024 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#include "helper.hpp" | ||
#include "openvino/op/concat.hpp" | ||
|
||
std::shared_ptr<ov::Model> get_dummy_model(ov::Core core, size_t num_layers) { | ||
ov::NodeVector keys; | ||
ov::NodeVector values; | ||
ov::ParameterVector params; | ||
ov::element::Type inference_precision = core.get_property("CPU", ov::hint::inference_precision); | ||
ov::element::Type kv_cache_type = core.get_property("CPU", ov::hint::kv_cache_precision); | ||
|
||
auto shape = ov::PartialShape({ov::Dimension::dynamic(), ov::Dimension::dynamic(), ov::Dimension::dynamic(), ov::Dimension::dynamic()}); | ||
for (size_t i = 0; i < num_layers; i++) { | ||
auto key = std::make_shared<ov::op::v0::Parameter>(kv_cache_type, shape); | ||
auto value = std::make_shared<ov::op::v0::Parameter>(kv_cache_type, shape); | ||
key->get_output_tensor(0).set_names({"key_cache." + std::to_string(i)}); | ||
value->get_output_tensor(0).set_names({"value_cache." + std::to_string(i)}); | ||
keys.push_back(key); | ||
values.push_back(value); | ||
params.push_back(key); | ||
params.push_back(value); | ||
} | ||
const auto& concat1 = std::make_shared<ov::op::v0::Concat>(keys, 1); | ||
const auto& concat2 = std::make_shared<ov::op::v0::Concat>(values, 1); | ||
auto model = std::make_shared<ov::Model>(ov::NodeVector{concat1, concat2}, params); | ||
return std::make_shared<ov::Model>(ov::NodeVector{concat1, concat2}, params); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Copyright (C) 2023-2024 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#pragma once | ||
|
||
#include "openvino/runtime/core.hpp" | ||
|
||
std::shared_ptr<ov::Model> get_dummy_model(ov::Core core, size_t num_layers); |
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