diff --git a/src/models/qwen2_5_vl_image_processor.cpp b/src/models/qwen2_5_vl_image_processor.cpp index 599ff946da..b40df82480 100644 --- a/src/models/qwen2_5_vl_image_processor.cpp +++ b/src/models/qwen2_5_vl_image_processor.cpp @@ -27,10 +27,6 @@ Qwen2_5VLImageProcessor::Qwen2_5VLImageProcessor(Config& config, const SessionIn } std::unique_ptr Qwen2_5VLImageProcessor::Process(const Tokenizer& tokenizer, const Payload& payload) const { - if (!payload.images) { - throw std::runtime_error("No images provided to Qwen2.5VLImageProcessor"); - } - std::string prompt = std::string(payload.prompt); Ort::Allocator& allocator{Ort::Allocator::GetWithDefaultOptions()}; auto named_tensors = std::make_unique(); @@ -41,6 +37,11 @@ std::unique_ptr Qwen2_5VLImageProcessor::Process(const Tokenizer& std::copy(input_ids.begin(), input_ids.end(), input_ids_value->GetTensorMutableData()); named_tensors->emplace(Config::Defaults::InputIdsName, std::make_shared(std::move(input_ids_value))); + if (!payload.images) { + // No images provided - return text-only tensors + return named_tensors; + } + // Run image preprocessing using onnxruntime-extensions // This will execute the full pipeline from processor_config.json: // DecodeImage -> ConvertRGB -> Resize (smart_resize) -> Rescale -> Normalize -> PatchImage diff --git a/src/models/qwen_vl_model.cpp b/src/models/qwen_vl_model.cpp index c1c8db2750..f510aabcf3 100644 --- a/src/models/qwen_vl_model.cpp +++ b/src/models/qwen_vl_model.cpp @@ -70,7 +70,7 @@ void Qwen2_5_VL_PipelineState::SetExtraInputs(const std::vector& ext } } if (!pixel_values_val) { - throw std::runtime_error("Vision pipeline: pixel_values input not found in extra_inputs"); + return; } auto pixel_type_info = pixel_values_val->GetTensorTypeAndShapeInfo();