@@ -139,76 +139,44 @@ const std::string expectedDefaultGraphContents = R"(
139
139
}
140
140
)" ;
141
141
142
- const std::string expectedRerankJsonContents = R"(
143
- {
144
- "model_config_list": [
145
- { "config":
146
- {
147
- "name": "myModel_tokenizer_model",
148
- "base_path": "tokenizer"
149
- }
150
- },
151
- { "config":
152
- {
153
- "name": "myModel_rerank_model",
154
- "base_path": "rerank",
155
- "target_device": "GPU",
156
- "plugin_config": { "NUM_STREAMS": "2" }
157
- }
158
- }
159
- ]
160
- }
161
- )" ;
162
-
163
- const std::string expectedEmbeddingsJsonContents = R"(
164
- {
165
- "model_config_list": [
166
- { "config":
167
- {
168
- "name": "myModel_tokenizer_model",
169
- "base_path": "tokenizer"
170
- }
171
- },
172
- { "config":
173
- {
174
- "name": "myModel_embeddings_model",
175
- "base_path": "embeddings",
176
- "target_device": "GPU",
177
- "plugin_config": { "NUM_STREAMS": "2" }
178
- }
179
- }
180
- ]
181
- }
182
- )" ;
183
-
184
- const std::string expectedRerankGraphContents = R"(
142
+ const std::string expectedRerankGraphContentsNonDefault = R"(
143
+ input_stream: "REQUEST_PAYLOAD:input"
144
+ output_stream: "RESPONSE_PAYLOAD:output"
145
+ node {
146
+ name: "myModel",
147
+ calculator: "RerankCalculatorOV"
148
+ input_side_packet: "RERANK_NODE_RESOURCES:rerank_servable"
185
149
input_stream: "REQUEST_PAYLOAD:input"
186
150
output_stream: "RESPONSE_PAYLOAD:output"
187
- node {
188
- calculator: "OpenVINOModelServerSessionCalculator"
189
- output_side_packet: "SESSION:tokenizer"
190
151
node_options: {
191
- [type.googleapis.com / mediapipe.OpenVINOModelServerSessionCalculatorOptions]: {
192
- servable_name: "myModel_tokenizer_model"
152
+ [type.googleapis.com / mediapipe.RerankCalculatorOVOptions]: {
153
+ models_path: "/some/path",
154
+ max_allowed_chunks: 18,
155
+ target_device: "GPU",
156
+ plugin_config: '{ "NUM_STREAMS": "2"}',
193
157
}
194
158
}
195
- }
196
- node {
197
- calculator: "OpenVINOModelServerSessionCalculator"
198
- output_side_packet: "SESSION:rerank"
159
+ }
160
+ )" ;
161
+
162
+ const std::string expectedRerankGraphContentsDefault = R"(
163
+ input_stream: "REQUEST_PAYLOAD:input"
164
+ output_stream: "RESPONSE_PAYLOAD:output"
165
+ node {
166
+ name: "",
167
+ calculator: "RerankCalculatorOV"
168
+ input_side_packet: "RERANK_NODE_RESOURCES:rerank_servable"
169
+ input_stream: "REQUEST_PAYLOAD:input"
170
+ output_stream: "RESPONSE_PAYLOAD:output"
199
171
node_options: {
200
- [type.googleapis.com / mediapipe.OpenVINOModelServerSessionCalculatorOptions]: {
201
- servable_name: "myModel_rerank_model"
172
+ [type.googleapis.com / mediapipe.RerankCalculatorOVOptions]: {
173
+ models_path: "./",
174
+ max_allowed_chunks: 10000,
175
+ target_device: "CPU",
176
+ plugin_config: '{ "NUM_STREAMS": "1"}',
202
177
}
203
178
}
204
- }
205
- node {
206
- input_side_packet: "TOKENIZER_SESSION:tokenizer"
207
- input_side_packet: "RERANK_SESSION:rerank"
208
- calculator: "RerankCalculator"
209
- input_stream: "REQUEST_PAYLOAD:input"
210
- output_stream: "RESPONSE_PAYLOAD:output"
211
- }
179
+ }
212
180
)" ;
213
181
214
182
const std::string expectedEmbeddingsGraphContents = R"(
@@ -317,15 +285,15 @@ TEST_F(GraphCreationTest, positiveDefault) {
317
285
ASSERT_EQ (expectedDefaultGraphContents, graphContents) << graphContents;
318
286
}
319
287
320
- TEST_F (GraphCreationTest, rerankPositiveDefault ) {
288
+ TEST_F (GraphCreationTest, rerankPositiveNonDefault ) {
321
289
ovms::HFSettingsImpl hfSettings;
322
290
hfSettings.task = ovms::RERANK_GRAPH;
323
291
ovms::RerankGraphSettingsImpl rerankGraphSettings;
324
292
rerankGraphSettings.targetDevice = " GPU" ;
325
293
rerankGraphSettings.modelName = " myModel" ;
294
+ rerankGraphSettings.modelPath = " /some/path" ;
326
295
rerankGraphSettings.numStreams = 2 ;
327
- rerankGraphSettings.maxDocLength = 18 ;
328
- rerankGraphSettings.version = 2 ;
296
+ rerankGraphSettings.maxAllowedChunks = 18 ;
329
297
hfSettings.graphSettings = std::move (rerankGraphSettings);
330
298
331
299
std::string graphPath = ovms::FileSystem::appendSlash (this ->directoryPath ) + " graph.pbtxt" ;
@@ -335,27 +303,23 @@ TEST_F(GraphCreationTest, rerankPositiveDefault) {
335
303
ASSERT_EQ (status, ovms::StatusCode::OK);
336
304
337
305
std::string graphContents = GetFileContents (graphPath);
338
- ASSERT_EQ (expectedRerankGraphContents, graphContents) << graphContents;
339
-
340
- std::string jsonContents = GetFileContents (subconfigPath);
341
- ASSERT_EQ (expectedRerankJsonContents, jsonContents) << jsonContents;
306
+ ASSERT_EQ (expectedRerankGraphContentsNonDefault, graphContents) << graphContents;
342
307
}
343
308
344
- TEST_F (GraphCreationTest, rerankCreatedJsonInvalid ) {
309
+ TEST_F (GraphCreationTest, rerankPositiveDefault ) {
345
310
ovms::HFSettingsImpl hfSettings;
346
311
hfSettings.task = ovms::RERANK_GRAPH;
347
312
ovms::RerankGraphSettingsImpl rerankGraphSettings;
348
- rerankGraphSettings.targetDevice = " GPU" ;
349
- rerankGraphSettings.modelName = " myModel\t " ;
350
- rerankGraphSettings.numStreams = 2 ;
351
- rerankGraphSettings.maxDocLength = 18 ;
352
- rerankGraphSettings.version = 2 ;
353
313
hfSettings.graphSettings = std::move (rerankGraphSettings);
314
+
354
315
std::string graphPath = ovms::FileSystem::appendSlash (this ->directoryPath ) + " graph.pbtxt" ;
355
316
std::string subconfigPath = ovms::FileSystem::appendSlash (this ->directoryPath ) + " subconfig.json" ;
356
317
std::unique_ptr<ovms::GraphExport> graphExporter = std::make_unique<ovms::GraphExport>();
357
318
auto status = graphExporter->createServableConfig (this ->directoryPath , hfSettings);
358
- ASSERT_EQ (status, ovms::StatusCode::JSON_INVALID);
319
+ ASSERT_EQ (status, ovms::StatusCode::OK);
320
+
321
+ std::string graphContents = GetFileContents (graphPath);
322
+ ASSERT_EQ (expectedRerankGraphContentsDefault, graphContents) << graphContents;
359
323
}
360
324
361
325
TEST_F (GraphCreationTest, rerankCreatedPbtxtInvalid) {
@@ -365,8 +329,6 @@ TEST_F(GraphCreationTest, rerankCreatedPbtxtInvalid) {
365
329
rerankGraphSettings.targetDevice = " GPU" ;
366
330
rerankGraphSettings.modelName = " myModel\" " ;
367
331
rerankGraphSettings.numStreams = 2 ;
368
- rerankGraphSettings.maxDocLength = 18 ;
369
- rerankGraphSettings.version = 2 ;
370
332
hfSettings.graphSettings = std::move (rerankGraphSettings);
371
333
std::string graphPath = ovms::FileSystem::appendSlash (this ->directoryPath ) + " graph.pbtxt" ;
372
334
std::string subconfigPath = ovms::FileSystem::appendSlash (this ->directoryPath ) + " subconfig.json" ;
0 commit comments