Skip to content

Commit a8a6136

Browse files
Cherry pick Fara text only fix for 0.11.4 release (#1913)
### Description This PR cherry-picks the Fara text-only fix PR into rel-0.11.4. ### Motivation and Context This cherry-pick needs to be included for the 0.11.4 patch release. Co-authored-by: Akshay Sonawane <111780983+apsonawane@users.noreply.github.com>
1 parent 94244ba commit a8a6136

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/models/qwen2_5_vl_image_processor.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ Qwen2_5VLImageProcessor::Qwen2_5VLImageProcessor(Config& config, const SessionIn
2727
}
2828

2929
std::unique_ptr<NamedTensors> Qwen2_5VLImageProcessor::Process(const Tokenizer& tokenizer, const Payload& payload) const {
30-
if (!payload.images) {
31-
throw std::runtime_error("No images provided to Qwen2.5VLImageProcessor");
32-
}
33-
3430
std::string prompt = std::string(payload.prompt);
3531
Ort::Allocator& allocator{Ort::Allocator::GetWithDefaultOptions()};
3632
auto named_tensors = std::make_unique<NamedTensors>();
@@ -41,6 +37,11 @@ std::unique_ptr<NamedTensors> Qwen2_5VLImageProcessor::Process(const Tokenizer&
4137
std::copy(input_ids.begin(), input_ids.end(), input_ids_value->GetTensorMutableData<int32_t>());
4238
named_tensors->emplace(Config::Defaults::InputIdsName, std::make_shared<Tensor>(std::move(input_ids_value)));
4339

40+
if (!payload.images) {
41+
// No images provided - return text-only tensors
42+
return named_tensors;
43+
}
44+
4445
// Run image preprocessing using onnxruntime-extensions
4546
// This will execute the full pipeline from processor_config.json:
4647
// DecodeImage -> ConvertRGB -> Resize (smart_resize) -> Rescale -> Normalize -> PatchImage

src/models/qwen_vl_model.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ void Qwen2_5_VL_PipelineState::SetExtraInputs(const std::vector<ExtraInput>& ext
7070
}
7171
}
7272
if (!pixel_values_val) {
73-
throw std::runtime_error("Vision pipeline: pixel_values input not found in extra_inputs");
73+
return;
7474
}
7575

7676
auto pixel_type_info = pixel_values_val->GetTensorTypeAndShapeInfo();

0 commit comments

Comments
 (0)