mirror of
https://github.com/huggingface/lerobot.git
synced 2026-05-22 20:19:43 +00:00
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:
@@ -255,9 +255,15 @@ class Qwen2VL(BaseVLM):
|
|||||||
# Try to find JSON object in response
|
# Try to find JSON object in response
|
||||||
match = re.search(r"\{.*\}", response, re.DOTALL)
|
match = re.search(r"\{.*\}", response, re.DOTALL)
|
||||||
if match:
|
if match:
|
||||||
data = json.loads(match.group())
|
try:
|
||||||
skills_data = data.get("skills", [])
|
data = json.loads(match.group())
|
||||||
return [Skill.from_dict(s) for s in skills_data]
|
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]}...")
|
raise ValueError(f"Could not parse skills from response: {response[:200]}...")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user