diff --git a/inference/core/workflows/core_steps/formatters/vlm_as_detector/v1.py b/inference/core/workflows/core_steps/formatters/vlm_as_detector/v1.py index e47409e7c9..bfdf84dc3f 100644 --- a/inference/core/workflows/core_steps/formatters/vlm_as_detector/v1.py +++ b/inference/core/workflows/core_steps/formatters/vlm_as_detector/v1.py @@ -224,6 +224,15 @@ def validate(self) -> "BlockManifest": raise ValueError( "Must pass list of classes to this block when using gemini or claude" ) + if ( + self.model_type == "florence-2" + and self.task_type == "open-vocabulary-object-detection" + and self.classes is None + ): + raise ValueError( + "Must pass list of classes to this block when using florence-2 " + "with open-vocabulary-object-detection task" + ) return self diff --git a/inference/core/workflows/core_steps/formatters/vlm_as_detector/v2.py b/inference/core/workflows/core_steps/formatters/vlm_as_detector/v2.py index 73f9bde112..918226ec19 100644 --- a/inference/core/workflows/core_steps/formatters/vlm_as_detector/v2.py +++ b/inference/core/workflows/core_steps/formatters/vlm_as_detector/v2.py @@ -244,6 +244,15 @@ def validate(self) -> "BlockManifest": raise ValueError( "Must pass list of classes to this block when using gemini or claude" ) + if ( + self.model_type == "florence-2" + and self.task_type == "open-vocabulary-object-detection" + and self.classes is None + ): + raise ValueError( + "Must pass list of classes to this block when using florence-2 " + "with open-vocabulary-object-detection task" + ) return self