roboflow/supervision · error · ValueError
Invalid vlm value: {vlm}. Must be one of {[e.value for e in
Error message
Invalid vlm value: {vlm}. Must be one of {[e.value for e in VLM]} What it means
Raised by the VLM argument validator in supervision's VLM module when the vlm argument is a string that does not match any VLM enum value after lowercasing. Supported values mirror VLM members (e.g. 'paligemma', 'florence-2', 'qwen-2.5-vl', 'qwen-3-vl', 'deepseek-vl2'). A VLM enum instance or an exactly-matching string are the only accepted inputs.
Source
Thrown at src/supervision/detection/vlm.py:190
"""
Validates the parameters and result type for a given Vision-Language Model (VLM).
Args:
vlm: The VLM enum or string specifying the model.
result: The result object to validate (type depends on VLM).
kwargs: Dictionary of arguments to validate against required/allowed lists.
Returns:
The validated VLM enum value.
Raises:
ValueError: If the VLM, result type, or arguments are invalid.
"""
if isinstance(vlm, str):
try:
vlm = VLM(vlm.lower())
except ValueError:
raise ValueError(
f"Invalid vlm value: {vlm}. Must be one of {[e.value for e in VLM]}"
)
if not isinstance(result, RESULT_TYPES[vlm]):
raise ValueError(
f"Invalid VLM result type: {type(result)}. Must be {RESULT_TYPES[vlm]}"
)
required_args = REQUIRED_ARGUMENTS.get(vlm, [])
for arg in required_args:
if arg not in kwargs:
raise ValueError(f"Missing required argument: {arg}")
allowed_args = ALLOWED_ARGUMENTS.get(vlm, [])
for arg in kwargs:
if arg not in allowed_args:
raise ValueError(f"Argument {arg} is not allowed for {vlm.name}")
View on GitHub (pinned to 7f254d9784)
Solutions
- Pass the enum member instead of a string: sv.detection.vlm.VLM.FLORENCE_2, which is immune to spelling issues.
- If using a string, copy it exactly from the error message's supported list (e.g. 'florence-2').
- Check the VLM enum in your installed version: python -c "from supervision.detection.vlm import VLM; print(VLM.list())".
- Upgrade supervision if you expect a model whose value is not in the list.
Example fix
# before detections = sv.Detections.from_vlm(vlm="florence2", result=result) # after from supervision.detection.vlm import VLM detections = sv.Detections.from_vlm(vlm=VLM.FLORENCE_2, result=result)
Defensive patterns
Strategy: validation
Validate before calling
from supervision.detection.vlm import VLM
valid = {e.value for e in VLM}
if vlm_name.strip().lower() not in valid:
raise ValueError(f"Unsupported VLM {vlm_name!r}; valid: {sorted(valid)}") Type guard
def is_valid_vlm_name(name: str) -> bool:
return name.strip().lower() in {e.value for e in VLM} Try / catch
try:
detections = sv.Detections.from_vlm(vlm=vlm_name, result=result)
except ValueError as e:
raise SystemExit(f"Configuration error: {e}") from e Prevention
- Prefer passing the VLM enum member over strings.
- Validate model names once at app startup, not per call.
- Print VLM.list() after upgrading supervision.
When it happens
Trigger: Calling sv.Detections.from_vlm(vlm='florence2', result=...) (missing hyphen), 'Qwen2.5-VL' style names, or a made-up model name; the lookup VLM(vlm.lower()) raises ValueError internally which is re-raised with the supported list.
Common situations: Using the HuggingFace model id ('microsoft/Florence-2-large') instead of the enum value; version drift when new VLMs were added/renamed across supervision releases; copy-pasting names from older docs that used the deprecated LMM enum values.
Related errors
- Unsupported VLM value: {vlm}.
- Expected string as {task} result, got {type(result)}
- Invalid value: {value}. Must be one of {cls.list()}
- Invalid value type: {type(value)}. Must be an instance of {c
- Unsupported color lookup strategy: {color_lookup}
AI-assisted analysis of roboflow/supervision@7f254d9784 (2026-08-15).
Data as JSON: /api/errors/1f9b11f0f2606b8b.
Report an issue: GitHub.