mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-30 17:52:35 +06:00
feat: allow to use hf-hub models for timm backbone (#34729)
Currently a backbone name like 'hf-hub:bioptimus/H-optimus-0' throws an error, even though it could work. Co-authored-by: Christian Gebbe <>
This commit is contained in:
parent
d8a5d31d9c
commit
1a0cd69435
@ -50,11 +50,6 @@ class TimmBackbone(PreTrainedModel, BackboneMixin):
|
||||
if config.backbone is None:
|
||||
raise ValueError("backbone is not set in the config. Please set it to a timm model name.")
|
||||
|
||||
# Certain timm models have the structure `model_name.version` e.g. vit_large_patch14_dinov2.lvd142m
|
||||
base_backbone_model = config.backbone.split(".")[0]
|
||||
if base_backbone_model not in timm.list_models():
|
||||
raise ValueError(f"backbone {base_backbone_model} is not supported by timm.")
|
||||
|
||||
if hasattr(config, "out_features") and config.out_features is not None:
|
||||
raise ValueError("out_features is not supported by TimmBackbone. Please use out_indices instead.")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user