[New Model]Bagel model(Diffusion Only) (#319)
Signed-off-by: wzliu <wzliu@connect.hku.hk> Signed-off-by: princepride <wangzhipeng628@gmail.com> Signed-off-by: 汪志鹏 <wangzhipeng628@gmail.com> Co-authored-by: wzliu <wzliu@connect.hku.hk> Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
9 files changed
+1737
-15
No files matched your search
@@ -14,6 +14,19 @@ def load_diffusers_config(model_name) -> dict:
|
||||
return config
|
||||
|
||||
|
||||
def _looks_like_bagel(model_name: str) -> bool:
|
||||
"""Best-effort detection for Bagel (non-diffusers) diffusion models."""
|
||||
try:
|
||||
cfg = get_hf_file_to_dict("config.json", model_name)
|
||||
except Exception:
|
||||
return False
|
||||
model_type = cfg.get("model_type")
|
||||
if model_type == "bagel":
|
||||
return True
|
||||
architectures = cfg.get("architectures") or []
|
||||
return "BagelForConditionalGeneration" in architectures
|
||||
|
||||
|
||||
@lru_cache
|
||||
def is_diffusion_model(model_name: str) -> bool:
|
||||
"""Check if a model is a diffusion model.
|
||||
@@ -61,4 +74,6 @@ def is_diffusion_model(model_name: str) -> bool:
|
||||
except Exception as e:
|
||||
logger.debug("Failed to load diffusers config via DiffusionPipeline: %s", e)
|
||||
|
||||
return False
|
||||
# Bagel is not a diffusers pipeline (no model_index.json), but is still a
|
||||
# diffusion-style model in vllm-omni. Detect it via config.json.
|
||||
return _looks_like_bagel(model_name)
|
||||
Reference in new issue
Block a user