{"record":{"id":"534979a73ec4282e","repo":"docling-project/docling","slug":"transformers-4-46-is-not-installed-please-insta","errorCode":null,"errorMessage":"transformers >=4.46 is not installed. Please install Docling with the required extras `pip install docling[vlm]`.","messagePattern":"transformers >=4\\.46 is not installed\\. Please install Docling with the required extras `pip install docling\\[vlm\\]`\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"docling/models/stages/picture_description/picture_description_vlm_model.py","lineNumber":63,"sourceCode":"        )\n        self.options: PictureDescriptionVlmOptions\n\n        if self.enabled:\n            if artifacts_path is None:\n                artifacts_path = self.download_models(repo_id=self.options.repo_id)\n            else:\n                artifacts_path = Path(artifacts_path) / self.options.repo_cache_folder\n\n            self.device = decide_device(accelerator_options.device)\n\n            try:\n                import torch\n                from transformers import (\n                    AutoModelForImageTextToText,\n                    AutoProcessor,\n                )\n            except ImportError:\n                raise ImportError(\n                    \"transformers >=4.46 is not installed. Please install Docling with the required extras `pip install docling[vlm]`.\"\n                )\n\n            # Initialize processor and model\n            with _model_init_lock:\n                self.processor = AutoProcessor.from_pretrained(artifacts_path)\n                tokenizer = getattr(self.processor, \"tokenizer\", None)\n                if tokenizer is not None:\n                    tokenizer.padding_side = self.options.padding_side\n                self.model = AutoModelForImageTextToText.from_pretrained(\n                    artifacts_path,\n                    device_map=self.device,\n                    dtype=torch.bfloat16,\n                    _attn_implementation=(\n                        \"flash_attention_2\"\n                        if self.device.startswith(\"cuda\")\n                        and accelerator_options.cuda_use_flash_attention2\n                        else \"sdpa\"","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/docling-project/docling/blob/61d76f1ff3f8428065465889f7b4577da7df704c/docling/models/stages/picture_description/picture_description_vlm_model.py#L45-L81","documentation":"The VLM picture-description model needs torch and transformers>=4.46 (AutoModelForImageTextToText). If either import fails at init, Docling raises this ImportError directing you to install the [vlm] extras rather than exposing a bare ModuleNotFoundError.","triggerScenarios":"Enabling picture description with the local VLM model in an environment lacking the vlm extras — docling-slim without extras, or a full install predating the extras split — so 'from transformers import AutoModelForImageTextToText' fails.","commonSituations":"Minimal/slim installs; older transformers (<4.46) pinned by another dependency so the symbol does not exist; CI images without the vlm extras.","solutions":["Install the extras: pip install 'docling[vlm]' (or pip install 'transformers>=4.46' torch).","If another dependency pins transformers below 4.46, upgrade or relax that pin.","Verify: python -c \"from transformers import AutoModelForImageTextToText\"."],"exampleFix":"# before\n# ImportError: transformers >=4.46 is not installed\n\n# after\n$ pip install \"docling[vlm]\"","handlingStrategy":"validation","validationCode":"try:\n    from transformers import AutoModelForImageTextToText  # requires >=4.46\n    vlm_ok = True\nexcept ImportError:\n    vlm_ok = False\n\nif use_vlm_descriptions and not vlm_ok:\n    raise SystemExit(\"VLM picture description requires: pip install 'docling[vlm]'\")","typeGuard":null,"tryCatchPattern":"try:\n    PictureDescriptionVlmModel(options=opts)\nexcept ImportError as e:\n    if \"docling[vlm]\" in str(e):\n        log.warning(\"VLM extras missing; disabling picture descriptions\")\n        opts.enabled = False\n    else:\n        raise","preventionTips":["Pin transformers>=4.46 (or install docling[vlm]) in the deployment manifest.","Smoke-test the AutoModelForImageTextToText import in CI for VLM-enabled builds.","Check the extras before enabling VLM options so failures happen at deploy time, not run time."],"tags":["vlm","pictures","dependency","transformers","environment"],"backgroundTag":null,"analyzedSha":"61d76f1ff3f8428065465889f7b4577da7df704c","analyzedAt":"2026-08-14T23:53:18.727Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}