Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/models/qwen2_5_vl_image_processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ Qwen2_5VLImageProcessor::Qwen2_5VLImageProcessor(Config& config, const SessionIn
}

std::unique_ptr<NamedTensors> 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<NamedTensors>();
Expand All @@ -41,6 +37,11 @@ std::unique_ptr<NamedTensors> Qwen2_5VLImageProcessor::Process(const Tokenizer&
std::copy(input_ids.begin(), input_ids.end(), input_ids_value->GetTensorMutableData<int32_t>());
named_tensors->emplace(Config::Defaults::InputIdsName, std::make_shared<Tensor>(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
Expand Down
2 changes: 1 addition & 1 deletion src/models/qwen_vl_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void Qwen2_5_VL_PipelineState::SetExtraInputs(const std::vector<ExtraInput>& 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();
Expand Down
Loading