Update src/lerobot/data_processing/data_annotations/vlm_annotations.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Jade Choghari <chogharijade@gmail.com>
This commit is contained in:
Jade Choghari
2026-03-11 16:10:37 -07:00
committed by GitHub
parent cc8e4c0d86
commit 0328b3f4aa
@@ -255,9 +255,15 @@ class Qwen2VL(BaseVLM):
# Try to find JSON object in response
match = re.search(r"\{.*\}", response, re.DOTALL)
if match:
data = json.loads(match.group())
skills_data = data.get("skills", [])
return [Skill.from_dict(s) for s in skills_data]
try:
data = json.loads(match.group())
skills_data = data.get("skills", [])
return [Skill.from_dict(s) for s in skills_data]
except json.JSONDecodeError as e:
excerpt = response[:200]
raise ValueError(
f"Could not parse JSON from VLM response (fallback failed): {excerpt}..."
) from e
raise ValueError(f"Could not parse skills from response: {response[:200]}...")