Interface API
Reference information for the Interface
API.
eva.Interface
A high-level interface for training and validating a machine learning model.
This class provides a convenient interface to connect a model, data, and trainer to train and validate a model.
fit
Perform model training and evaluation out-of-place.
This method uses the specified trainer to fit the model using the provided data.
Example use cases:
- Using a model consisting of a frozen backbone and a head, the backbone will generate the embeddings on the fly which are then used as input features to train the head on the downstream task specified by the given dataset.
- Fitting only the head network using a dataset that loads pre-computed embeddings.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trainer |
Trainer
|
The base trainer to use but not modify. |
required |
model |
ModelModule
|
The model module to use but not modify. |
required |
data |
DataModule
|
The data module. |
required |
Source code in src/eva/core/interface/interface.py
predict
Perform model prediction out-of-place.
This method performs inference with a pre-trained foundation model to compute embeddings.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trainer |
Trainer
|
The base trainer to use but not modify. |
required |
model |
ModelModule
|
The model module to use but not modify. |
required |
data |
DataModule
|
The data module. |
required |
Source code in src/eva/core/interface/interface.py
predict_fit
Combines the predict and fit commands in one method.
This method performs the following two steps: 1. predict: perform inference with a pre-trained foundation model to compute embeddings. 2. fit: training the head network using the embeddings generated in step 1.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trainer |
Trainer
|
The base trainer to use but not modify. |
required |
model |
ModelModule
|
The model module to use but not modify. |
required |
data |
DataModule
|
The data module. |
required |
Source code in src/eva/core/interface/interface.py
validate
Perform model validation out-of-place without running fit.
This method is useful when the model is already trained or does not require further training (e.g., large language models) and you only want to measure performance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trainer |
Trainer
|
The base trainer to use but not modify. |
required |
model |
ModelModule
|
The model module to use but not modify. |
required |
data |
DataModule
|
The data module containing validation data. |
required |