{"record":{"id":"e10820b1b901281e","repo":"sgl-project/sglang","slug":"diffusion-weights-must-come-from-a-hugging-face-mo","errorCode":null,"errorMessage":"Diffusion weights must come from a Hugging Face model repo","messagePattern":"Diffusion weights must come from a Hugging Face model repo","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/weights/source.py","lineNumber":78,"sourceCode":"    if url_revision is not None and revision is not None and url_revision != revision:\n        raise ValueError(\n            f\"Weight URL pins revision {url_revision!r}, which conflicts with \"\n            f\"revision {revision!r}\"\n        )\n    return url_revision or revision\n\n\ndef _parse_huggingface_url(source: str, revision: str | None) -> WeightSource:\n    parsed = urlparse(source)\n    if parsed.netloc.lower() not in (\"huggingface.co\", \"www.huggingface.co\"):\n        raise ValueError(\n            \"Only huggingface.co weight URLs are supported; use a local path \"\n            \"or an owner/repo reference for other sources\"\n        )\n\n    raw_parts = [part for part in parsed.path.split(\"/\") if part]\n    if raw_parts and raw_parts[0] in (\"datasets\", \"spaces\"):\n        raise ValueError(\"Diffusion weights must come from a Hugging Face model repo\")\n    if len(raw_parts) < 2:\n        raise ValueError(f\"Hugging Face weight URL has no model repo: {source!r}\")\n\n    repo_id = \"/\".join(unquote(part) for part in raw_parts[:2])\n    validate_repo_id(repo_id)\n    action = raw_parts[2] if len(raw_parts) > 2 else None\n    if action is None:\n        return WeightSource(\n            original=source,\n            kind=\"huggingface\",\n            repo_id=repo_id,\n            revision=revision,\n        )\n    if action not in (\"tree\", \"blob\", \"resolve\") or len(raw_parts) < 4:\n        raise ValueError(f\"Unsupported Hugging Face weight URL: {source!r}\")\n\n    url_revision = unquote(raw_parts[3])\n    selected_revision = _merge_revision(url_revision, revision)","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/weights/source.py#L60-L96","documentation":"Raised by _parse_huggingface_url when the URL path starts with 'datasets' or 'spaces', i.e. the URL points at a Hugging Face dataset or Space rather than a model repo. Diffusion weights must live in a model repo.","triggerScenarios":"Calling parse_weight_source with https://huggingface.co/datasets/org/name or https://huggingface.co/spaces/org/name.","commonSituations":"Copying the wrong tab's URL from the Hub (datasets/spaces instead of models), or storing weights in a dataset repo for quota reasons.","solutions":["Use the model-repo URL, e.g. https://huggingface.co/org/model-name","Move/publish the weights into a model repo if they currently live in a dataset repo","If it is genuinely dataset content, load it via a dataset loader, not the weight source parser"],"exampleFix":"# before\nparse_weight_source(\"https://huggingface.co/datasets/org/diffusion-data\")\n# after\nparse_weight_source(\"https://huggingface.co/org/diffusion-model\")","handlingStrategy":"type-guard","validationCode":"parts = [p for p in urlparse(url).path.split(\"/\") if p]\nif parts and parts[0] in (\"datasets\", \"spaces\"):\n    raise ValueError(\"pass a model repo URL, not a dataset/space\")","typeGuard":"def is_model_repo_url(url: str) -> bool:\n    parts = [p for p in urlparse(url).path.split(\"/\") if p]\n    return not (parts and parts[0] in (\"datasets\", \"spaces\"))","tryCatchPattern":null,"preventionTips":["Copy weight URLs from the Hub's Models tab only","Store canonical owner/repo ids in config rather than full URLs"],"tags":["huggingface","weights","wrong-repo-type"],"backgroundTag":"wrong-repository-type","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}