{"record":{"id":"f92b0271312bbd21","repo":"unslothai/unsloth","slug":"all-total-samples-failed-during-sharegpt-image-c","errorCode":null,"errorMessage":"All {total} samples failed during ShareGPT+image conversion — no usable samples found.","messagePattern":"All (.+?) samples failed during ShareGPT\\+image conversion — no usable samples found\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"studio/backend/utils/datasets/format_conversion.py","lineNumber":875,"sourceCode":"        desc = \"Converting ShareGPT+image\",\n        unit = \"sample\",\n        **_quiet_bar_kwargs(),\n    )\n    for sample in pbar:\n        try:\n            converted_list.append(_convert_single_sample(sample))\n        except Exception as e:\n            failed_count += 1\n            if failed_count == 1:\n                logger.info(f\"⚠️ First conversion failure: {type(e).__name__}: {e}\")\n        pbar.set_postfix(ok = len(converted_list), failed = failed_count, refresh = False)\n    pbar.close()\n\n    if failed_count > 0:\n        logger.info(f\"⚠️ Skipped {failed_count}/{total} ({failed_count*100//total}%) samples\")\n\n    if len(converted_list) == 0:\n        raise ValueError(\n            f\"All {total} samples failed during ShareGPT+image conversion — \"\n            \"no usable samples found.\"\n        )\n\n    logger.info(f\"✅ Converted {len(converted_list)}/{total} samples\")\n    _notify(f\"Converted {len(converted_list):,}/{total:,} samples successfully\")\n    return converted_list\n\n\ndef convert_llava_to_vlm_format(dataset):\n    \"\"\"\n    Convert Llava format to standard VLM format.\n\n    Llava format:\n    - messages: [{'content': [{'type': 'image', 'index': 0}, {'type': 'text', 'text': '...'}]}]\n    - images: [PIL_Image1, PIL_Image2, ...]\n\n    Standard VLM format:","sourceCodeStart":857,"sourceCodeEnd":893,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/utils/datasets/format_conversion.py#L857-L893","documentation":"Raised at the end of ShareGPT+image conversion when every sample raised inside _convert_single_sample and converted_list is empty. Only the first failure's exception type and message are logged (to avoid log spam), so the root cause requires checking the earlier 'First conversion failure' log line. The message names the conversion type so it is distinguishable from the plain-VLM variant.","triggerScenarios":"All samples fail _convert_single_sample: _resolve_image rejecting the image value on every row, or the messages column missing 'from'/'role'+'value'/'content' keys so message extraction fails on every row.","commonSituations":"ShareGPT dataset with an images column of dead URLs; conversation field named differently than expected; schema where content is nested one level deeper; paired wrong column names (messages_column pointing at the image column).","solutions":["Read the logged first-failure line ('⚠️ First conversion failure: <Type>: <msg>') — it identifies the actual root cause.","Validate one sample manually: resolve the image and walk the conversation structure before running full conversion.","Fix column mapping (messages_column must be the list-of-{from,value} dicts; image_column the image source).","Repair or drop broken rows so at least one sample converts.","If messages use a different key scheme, pre-normalize to from/value before conversion."],"exampleFix":"# before\nconverted = convert_sharegpt_images(ds, messages_column=\"chat\")  # wrong column -> all fail\n\n# after\nconverted = convert_sharegpt_images(ds, messages_column=\"conversations\", image_column=\"images\")","handlingStrategy":"validation","validationCode":"def sharegpt_sample_is_convertible(sample, image_column, messages_column):\n    img = sample[image_column]\n    img_ok = isinstance(img, str) or (\n        isinstance(img, dict) and (img.get(\"bytes\") or img.get(\"path\"))\n    )\n    msgs = sample.get(messages_column)\n    msgs_ok = isinstance(msgs, list) and all(\n        isinstance(m, dict) and (m.get(\"from\") or m.get(\"role\"))\n        and (m.get(\"value\") is not None or m.get(\"content\") is not None)\n        for m in msgs\n    )\n    return img_ok and msgs_ok\n\n# require sharegpt_sample_is_convertible(ds[0], img_col, msg_col) before batch conversion","typeGuard":null,"tryCatchPattern":"try:\n    converted = convert_sharegpt_images(ds, messages_column=mcol)\nexcept ValueError as e:\n    if \"no usable samples found\" in str(e):\n        # check earlier log for 'First conversion failure' to get root cause\n        raise\n    raise","preventionTips":["Convert a single sample first as a smoke test before the full run.","Keep the 'First conversion failure' log line enabled — it carries the root cause.","Verify messages_column points at a list of {'from'/'role', 'value'/'content'} dicts.","Validate the image column shapes with the same rules as _resolve_image."],"tags":["dataset","sharegpt","vlm","conversion","column-config"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}