Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions mteb/models/get_model_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,18 @@ def get_model(


def get_model_meta(
model_name: str, revision: str | None = None, fetch_from_hf: bool = True
model_name: str,
revision: str | None = None,
fetch_from_hf: bool = True,
compute_missing: bool = False,
) -> ModelMeta:
"""A function to fetch a model metadata object by name.

Args:
model_name: Name of the model to fetch
revision: Revision of the model to fetch
fetch_from_hf: Whether to fetch the model from HuggingFace Hub if not found in the registry
compute_missing: Computes missing attributes from the metadata including number of parameters and memory usage.

Returns:
A model metadata object
Expand All @@ -124,10 +128,15 @@ def get_model_meta(
raise ValueError(
f"Model revision {revision} not found for model {model_name}. Expected {model_meta.revision}."
)
return model_meta

new_meta = ModelMeta.from_hf(model_name)
return ModelMeta(
**model_meta.model_dump(), **new_meta.model_dump(exclude_none=True)
)
Comment thread
ayush1298 marked this conversation as resolved.
Outdated

Comment thread
ayush1298 marked this conversation as resolved.
if fetch_from_hf:
logger.info(
"Model not found in model registry. Attempting to extract metadata by loading the model ({model_name}) using HuggingFace."
f"Model not found in model registry. Attempting to extract metadata by loading the model ({model_name}) using HuggingFace."
)
meta = ModelMeta.from_hub(model_name, revision)
return meta
Expand Down
Loading