Wrappers
Reference information for the model Wrappers
API.
eva.models.wrappers.BaseModel
Bases: Module
Base class for model wrappers.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tensor_transforms |
Callable | None
|
The transforms to apply to the output tensor produced by the model. |
None
|
Source code in src/eva/core/models/wrappers/base.py
load_model
abstractmethod
model_forward
Implements the forward pass of the model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tensor |
Tensor
|
The input tensor to the model. |
required |
eva.models.wrappers.ModelFromFunction
Bases: BaseModel
Wrapper class for models which are initialized from functions.
This is helpful for initializing models in a .yaml
configuration file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
Callable[..., Module]
|
The path to the callable object (class or function). |
required |
arguments |
Dict[str, Any] | None
|
The extra callable function / class arguments. |
None
|
checkpoint_path |
str | None
|
The path to the checkpoint to load the model
weights from. This is currently only supported for torch
model checkpoints. For other formats, the checkpoint loading
should be handled within the provided callable object in |
None
|
tensor_transforms |
Callable | None
|
The transforms to apply to the output tensor produced by the model. |
None
|
Source code in src/eva/core/models/wrappers/from_function.py
eva.models.wrappers.HuggingFaceModel
Bases: BaseModel
Wrapper class for loading HuggingFace transformers
models.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_name_or_path |
str
|
The model name or path to load the model from.
This can be a local path or a model name from the |
required |
tensor_transforms |
Callable | None
|
The transforms to apply to the output tensor produced by the model. |
None
|
model_kwargs |
Dict[str, Any] | None
|
The arguments used for instantiating the model. |
None
|
Source code in src/eva/core/models/wrappers/huggingface.py
eva.models.wrappers.ONNXModel
Bases: BaseModel
Wrapper class for loading ONNX models.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
The path to the .onnx model file. |
required |
device |
Literal['cpu', 'cuda'] | None
|
The device to run the model on. This can be either "cpu" or "cuda". |
'cpu'
|
tensor_transforms |
Callable | None
|
The transforms to apply to the output tensor produced by the model. |
None
|