Skip to content

Commit 944c8ec

Browse files
committed
v1
1 parent 6156c31 commit 944c8ec

File tree

5 files changed

+168
-2
lines changed

5 files changed

+168
-2
lines changed

src/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,7 @@ cc_library(
611611
}) + select({
612612
"//conditions:default": [],
613613
"//:not_disable_mediapipe" : [
614+
"//src/image_gen:image_gen_calculator",
614615
"//src/llm:openai_completions_api_handler",
615616
"//src/embeddings:embeddingscalculator",
616617
"//src/rerank:rerankcalculator",],

src/image_gen/BUILD

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#
2+
# Copyright (c) 2024 Intel Corporation
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
load("@mediapipe//mediapipe/framework/port:build_config.bzl", "mediapipe_cc_proto_library", "mediapipe_proto_library")
18+
load("//:common_settings.bzl",
19+
"COMMON_STATIC_LIBS_COPTS", "COMMON_STATIC_LIBS_LINKOPTS", "COMMON_FUZZER_COPTS", "COMMON_FUZZER_LINKOPTS", "COMMON_LOCAL_DEFINES", "PYBIND_DEPS")
20+
21+
COPTS_ADJUSTED = COMMON_STATIC_LIBS_COPTS + select({
22+
"//conditions:default": [],
23+
"//:fuzzer_build" : COMMON_FUZZER_COPTS,
24+
})
25+
26+
LINKOPTS_ADJUSTED = COMMON_STATIC_LIBS_LINKOPTS + select({
27+
"//conditions:default": [],
28+
"//:fuzzer_build" : COMMON_FUZZER_LINKOPTS,
29+
})
30+
31+
cc_library(
32+
name = "llm_engine", # in fact this is genai library, includes image gen, TODO: Change name?
33+
srcs = [],
34+
deps = ["@llm_engine//:llm_engine"],
35+
visibility = ["//visibility:public"],
36+
copts = COPTS_ADJUSTED,
37+
linkopts = LINKOPTS_ADJUSTED,
38+
alwayslink = 1,
39+
)
40+
41+
cc_library(
42+
name = "image_gen_calculator",
43+
srcs = ["http_image_gen_calculator.cc"],
44+
deps = [
45+
"@mediapipe//mediapipe/framework:calculator_framework",
46+
"//src:httppayload",
47+
"//src:libovmslogging",
48+
"image_gen_calculator_cc_proto",
49+
]+ select({
50+
"//conditions:default": ["//third_party:genai", ":llm_engine"],
51+
"//:not_genai_bin" : [":llm_engine"],
52+
}),
53+
visibility = ["//visibility:public"],
54+
local_defines = COMMON_LOCAL_DEFINES,
55+
copts = COPTS_ADJUSTED,
56+
linkopts = LINKOPTS_ADJUSTED,
57+
alwayslink = 1,
58+
)
59+
60+
mediapipe_proto_library(
61+
name = "image_gen_calculator_proto",
62+
srcs = ["image_gen_calculator.proto"],
63+
visibility = ["//visibility:private"],
64+
deps = [
65+
"@mediapipe//mediapipe/framework:calculator_options_proto",
66+
"@mediapipe//mediapipe/framework:calculator_proto",
67+
],
68+
)
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
//*****************************************************************************
2+
// Copyright 2025 Intel Corporation
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
//*****************************************************************************
16+
#pragma warning(push)
17+
#pragma warning(disable : 4005 4309 6001 6385 6386 6326 6011 6246 4456 6246)
18+
#pragma GCC diagnostic push
19+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
20+
#include "mediapipe/framework/calculator_framework.h"
21+
#include "mediapipe/framework/port/canonical_errors.h"
22+
#pragma GCC diagnostic pop
23+
#pragma warning(pop)
24+
25+
#include "../http_payload.hpp"
26+
#include "../logging.hpp"
27+
28+
using namespace ovms;
29+
30+
namespace mediapipe {
31+
32+
class HttpImageGenCalculator : public CalculatorBase {
33+
static const std::string INPUT_TAG_NAME;
34+
static const std::string OUTPUT_TAG_NAME;
35+
36+
public:
37+
static absl::Status GetContract(CalculatorContract* cc) {
38+
RET_CHECK(!cc->Inputs().GetTags().empty());
39+
RET_CHECK(!cc->Outputs().GetTags().empty());
40+
cc->Inputs().Tag(INPUT_TAG_NAME).Set<ovms::HttpPayload>();
41+
cc->Outputs().Tag(OUTPUT_TAG_NAME).Set<std::string>();
42+
return absl::OkStatus();
43+
}
44+
45+
absl::Status Close(CalculatorContext* cc) final {
46+
SPDLOG_LOGGER_DEBUG(llm_calculator_logger, "HttpImageGenCalculator [Node: {} ] Close", cc->NodeName());
47+
return absl::OkStatus();
48+
}
49+
50+
absl::Status Open(CalculatorContext* cc) final {
51+
SPDLOG_LOGGER_DEBUG(llm_calculator_logger, "HttpImageGenCalculator [Node: {}] Open start", cc->NodeName());
52+
return absl::OkStatus();
53+
}
54+
55+
absl::Status Process(CalculatorContext* cc) final {
56+
SPDLOG_LOGGER_DEBUG(llm_calculator_logger, "HttpImageGenCalculator [Node: {}] Process start", cc->NodeName());
57+
SPDLOG_LOGGER_DEBUG(llm_calculator_logger, "HttpImageGenCalculator [Node: {}] Process end", cc->NodeName());
58+
return absl::OkStatus();
59+
}
60+
};
61+
62+
const std::string HttpImageGenCalculator::INPUT_TAG_NAME{"HTTP_REQUEST_PAYLOAD"};
63+
const std::string HttpImageGenCalculator::OUTPUT_TAG_NAME{"HTTP_RESPONSE_PAYLOAD"};
64+
65+
REGISTER_CALCULATOR(HttpImageGenCalculator);
66+
67+
} // namespace mediapipe
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//*****************************************************************************
2+
// Copyright 2024 Intel Corporation
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
//*****************************************************************************
16+
17+
syntax = "proto2";
18+
package mediapipe;
19+
20+
import "mediapipe/framework/calculator.proto";
21+
22+
message ImageGenCalculatorOptions {
23+
extend mediapipe.CalculatorOptions {
24+
// https://github.com/google/mediapipe/issues/634 have to be unique in app
25+
// no rule to obtain this
26+
optional ImageGenCalculatorOptions ext = 116423751;
27+
}
28+
29+
optional string models_path = 1;
30+
}

third_party/llm_engine/llm_engine.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ def llm_engine():
2323
llm_engine_repository(name="_llm_engine")
2424
new_git_repository(
2525
name = "llm_engine",
26-
remote = "https://github.com/openvinotoolkit/openvino.genai",
27-
commit = "a8146b175283a979023b47ce6192e71b070bc70f", # master 2025-05-02
26+
remote = "https://github.com/dkalinowski/openvino.genai",
27+
commit = "4813206d9699f3fab4673e726a3b493a572dedb7", # master 2025-05-02
2828
build_file = "@_llm_engine//:BUILD",
2929
init_submodules = True,
3030
recursive_init_submodules = True,

0 commit comments

Comments
 (0)