Skip to content

Commit 1b7e667

Browse files
committed
Adjust options
1 parent 94495b4 commit 1b7e667

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/cpp/src/rag/text_embedding_pipeline.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -245,17 +245,16 @@ class TextEmbeddingPipeline::TextEmbeddingPipelineImpl {
245245
}
246246
}
247247

248-
bool should_reshape = (device != "NPU" && (m_config.batch_size.has_value() || m_config.max_length.has_value())) ||
249-
(device == "NPU" && m_config.batch_size.has_value() && is_fixed_size);
250-
if (should_reshape) {
248+
bool should_reshape_non_npu = (device != "NPU" && (m_config.batch_size.has_value() || m_config.max_length.has_value()));
249+
bool should_reshape_npu = (device == "NPU" && m_config.batch_size.has_value() && is_fixed_size);
250+
if (should_reshape_non_npu || should_reshape_npu) {
251251
reshape_model(model);
252252
}
253253

254254
ov::CompiledModel compiled_model;
255255
if (device == "NPU" && model->is_dynamic()) {
256-
const auto is_padding = m_config.pad_to_max_length.has_value() && m_config.pad_to_max_length.value();
257-
OPENVINO_ASSERT(!is_padding || config.pooling_type == TextEmbeddingPipeline::PoolingType::MEAN,
258-
"Padding is only supported for the mean post-processing type");
256+
OPENVINO_ASSERT(!(is_padding_on_left && is_fixed_size) || config.pooling_type == TextEmbeddingPipeline::PoolingType::MEAN,
257+
"Padding on left is only supported for the mean post-processing type");
259258

260259
auto kv_pos = ov::genai::utils::get_kv_axes_pos(model);
261260
utils::KVDesc kv_desc;

src/cpp/src/utils.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -608,10 +608,7 @@ void import_npu_model(ov::CompiledModel& compiled,
608608
}
609609

610610
void export_npu_model(ov::CompiledModel& compiled,
611-
std::string& blob_path) {
612-
if (blob_path.empty()) {
613-
blob_path = "openvino_model.blob";
614-
}
611+
const std::string& blob_path) {
615612
// Check the path is full
616613
const int EXT_SIZE = 5; // ".blob"
617614
if (blob_path.size() < EXT_SIZE) {
@@ -680,6 +677,9 @@ compile_decoder_for_npu_impl(const std::shared_ptr<ov::Model>& model,
680677
compiled = ov::genai::utils::singleton_core().compile_model(model, "NPU", properties);
681678
// Also export compiled model if required
682679
if (export_blob) {
680+
if (blob_path.empty()) {
681+
blob_path = "openvino_model.blob";
682+
}
683683
export_npu_model(compiled, blob_path);
684684
}
685685
}

0 commit comments

Comments
 (0)