From 219f89fd80039a34ca593eb40d97a8a57278f4c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20P=C3=A9rez=20Torres?= <99720527+eloy-encord@users.noreply.github.com> Date: Tue, 7 May 2024 13:23:42 +0100 Subject: [PATCH] chore: update HF model naming convention (#72) Make model naming conventions consistent with the dataset naming conventions. --- README.md | 6 +++--- sources/models/clip.json | 2 +- sources/models/fashion.json | 2 +- sources/models/plip.json | 2 +- sources/models/pubmed.json | 2 +- sources/models/rsicd.json | 2 +- sources/models/siglip_large.json | 2 +- sources/models/siglip_small.json | 2 +- sources/models/street.json | 2 +- sources/models/tinyclip.json | 2 +- tti_eval/model/types/__init__.py | 2 +- .../model/types/{hugging_face_clip.py => hugging_face.py} | 2 +- 12 files changed, 14 insertions(+), 14 deletions(-) rename tti_eval/model/types/{hugging_face_clip.py => hugging_face.py} (99%) diff --git a/README.md b/README.md index 46532d6..4c8c94e 100644 --- a/README.md +++ b/README.md @@ -298,7 +298,7 @@ Below is an example of a model definition for the [clip](https://huggingface.co/ ```json { - "model_type": "ClosedCLIPModel", + "model_type": "HFModel", "title": "clip", "title_in_source": "openai/clip-vit-large-patch14-336" } @@ -331,9 +331,9 @@ Here is an example of how to register a model from Hugging Face using Python cod ```python from tti_eval.model import ModelProvider -from tti_eval.model.types import ClosedCLIPModel +from tti_eval.model.types import HFModel -ModelProvider.register_model(ClosedCLIPModel, "clip", title_in_source="openai/clip-vit-large-patch14-336") +ModelProvider.register_model(HFModel, "clip", title_in_source="openai/clip-vit-large-patch14-336") model = ModelProvider.get_model("clip") print(model.title, model.title_in_source) # Returns: clip openai/clip-vit-large-patch14-336 ``` diff --git a/sources/models/clip.json b/sources/models/clip.json index f320a2f..e06ec03 100644 --- a/sources/models/clip.json +++ b/sources/models/clip.json @@ -1,5 +1,5 @@ { - "model_type": "ClosedCLIPModel", + "model_type": "HFModel", "title": "clip", "title_in_source": "openai/clip-vit-large-patch14-336" } diff --git a/sources/models/fashion.json b/sources/models/fashion.json index e6412b6..19d0dd3 100644 --- a/sources/models/fashion.json +++ b/sources/models/fashion.json @@ -1,5 +1,5 @@ { - "model_type": "ClosedCLIPModel", + "model_type": "HFModel", "title": "fashion", "title_in_source": "patrickjohncyh/fashion-clip" } diff --git a/sources/models/plip.json b/sources/models/plip.json index 621d693..eed7d24 100644 --- a/sources/models/plip.json +++ b/sources/models/plip.json @@ -1,5 +1,5 @@ { - "model_type": "ClosedCLIPModel", + "model_type": "HFModel", "title": "plip", "title_in_source": "vinid/plip" } diff --git a/sources/models/pubmed.json b/sources/models/pubmed.json index 5d56c6e..b26aeae 100644 --- a/sources/models/pubmed.json +++ b/sources/models/pubmed.json @@ -1,5 +1,5 @@ { - "model_type": "ClosedCLIPModel", + "model_type": "HFModel", "title": "pubmed", "title_in_source": "flaviagiammarino/pubmed-clip-vit-base-patch32" } diff --git a/sources/models/rsicd.json b/sources/models/rsicd.json index 1d8a1b7..9493dc6 100644 --- a/sources/models/rsicd.json +++ b/sources/models/rsicd.json @@ -1,5 +1,5 @@ { - "model_type": "ClosedCLIPModel", + "model_type": "HFModel", "title": "rsicd", "title_in_source": "flax-community/clip-rsicd" } diff --git a/sources/models/siglip_large.json b/sources/models/siglip_large.json index b904931..9439c2d 100644 --- a/sources/models/siglip_large.json +++ b/sources/models/siglip_large.json @@ -1,5 +1,5 @@ { - "model_type": "ClosedCLIPModel", + "model_type": "HFModel", "title": "siglip_large", "title_in_source": "google/siglip-large-patch16-256" } diff --git a/sources/models/siglip_small.json b/sources/models/siglip_small.json index 107b2d7..c8abe05 100644 --- a/sources/models/siglip_small.json +++ b/sources/models/siglip_small.json @@ -1,5 +1,5 @@ { - "model_type": "ClosedCLIPModel", + "model_type": "HFModel", "title": "siglip_small", "title_in_source": "google/siglip-base-patch16-224" } diff --git a/sources/models/street.json b/sources/models/street.json index 990b7b7..eabd191 100644 --- a/sources/models/street.json +++ b/sources/models/street.json @@ -1,5 +1,5 @@ { - "model_type": "ClosedCLIPModel", + "model_type": "HFModel", "title": "street", "title_in_source": "geolocal/StreetCLIP" } diff --git a/sources/models/tinyclip.json b/sources/models/tinyclip.json index d85f8fe..b11c653 100644 --- a/sources/models/tinyclip.json +++ b/sources/models/tinyclip.json @@ -1,5 +1,5 @@ { - "model_type": "ClosedCLIPModel", + "model_type": "HFModel", "title": "tinyclip", "title_in_source": "wkcn/TinyCLIP-ViT-40M-32-Text-19M-LAION400M" } diff --git a/tti_eval/model/types/__init__.py b/tti_eval/model/types/__init__.py index 3860b64..c972431 100644 --- a/tti_eval/model/types/__init__.py +++ b/tti_eval/model/types/__init__.py @@ -1,3 +1,3 @@ -from tti_eval.model.types.hugging_face_clip import ClosedCLIPModel +from tti_eval.model.types.hugging_face import HFModel from tti_eval.model.types.local_clip_model import LocalCLIPModel from tti_eval.model.types.open_clip_model import OpenCLIPModel diff --git a/tti_eval/model/types/hugging_face_clip.py b/tti_eval/model/types/hugging_face.py similarity index 99% rename from tti_eval/model/types/hugging_face_clip.py rename to tti_eval/model/types/hugging_face.py index d5b265a..55ec84a 100644 --- a/tti_eval/model/types/hugging_face_clip.py +++ b/tti_eval/model/types/hugging_face.py @@ -14,7 +14,7 @@ from tti_eval.model import Model -class ClosedCLIPModel(Model): +class HFModel(Model): def __init__( self, title: str,