ModelRegistry
ModelRegistry
#
Central registry of pretrained models.
This class serves as a centralized registry for all pretrained models in the Focoos system. It provides methods to access model information, list available models, and check model existence.
Attributes:
Name | Type | Description |
---|---|---|
_pretrained_models |
Dict[str, str]
|
Dictionary mapping model names to their JSON file paths. |
Source code in focoos/model_registry/model_registry.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
|
exists(model_name)
classmethod
#
Check if a model exists in the registry.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_name
|
str
|
The name of the model to check. |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if the model exists in the pretrained models registry, False otherwise. |
Source code in focoos/model_registry/model_registry.py
67 68 69 70 71 72 73 74 75 76 77 78 |
|
get_model_info(model_name)
classmethod
#
Get the model information for a given model name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_name
|
str
|
The name of the model to retrieve information for. Can be either a pretrained model name or a path to a JSON file. |
required |
Returns:
Name | Type | Description |
---|---|---|
ModelInfo |
ModelInfo
|
The model information object containing model details. |
Raises:
Type | Description |
---|---|
ValueError
|
If the model is not found in the registry and the provided path does not exist. |
Source code in focoos/model_registry/model_registry.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
|
list_models()
classmethod
#
List all available pretrained models.
Returns:
Type | Description |
---|---|
list[str]
|
list[str]: A list of all available pretrained model names. |
Source code in focoos/model_registry/model_registry.py
58 59 60 61 62 63 64 65 |
|