evaluation
BaseEvaluationModel(config)
¶
Bases: ABC
Base interface for all evaluation models.
Source code in quadra/models/evaluation.py
29 30 31 32 33 34 35 |
|
device: str
property
writable
¶
Return the device of the model.
training: bool
property
¶
Return whether model is in training mode.
cpu()
abstractmethod
¶
Move model to cpu.
Source code in quadra/models/evaluation.py
57 58 59 |
|
eval()
abstractmethod
¶
Set model to evaluation mode.
Source code in quadra/models/evaluation.py
49 50 51 |
|
half()
abstractmethod
¶
Convert model to half precision.
Source code in quadra/models/evaluation.py
53 54 55 |
|
load_from_disk(model_path, device='cpu')
abstractmethod
¶
Load model from disk.
Source code in quadra/models/evaluation.py
41 42 43 |
|
to(device)
abstractmethod
¶
Move model to device.
Source code in quadra/models/evaluation.py
45 46 47 |
|
ONNXEvaluationModel(config)
¶
Bases: BaseEvaluationModel
Wrapper for ONNX models. It's designed to provide a similar interface to standard torch models.
Source code in quadra/models/evaluation.py
180 181 182 183 184 185 186 |
|
__call__(*inputs)
¶
Run inference on the model and return the output as torch tensors.
Source code in quadra/models/evaluation.py
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
|
cast_onnx_dtype(onnx_dtype)
¶
Cast ONNX dtype to numpy or pytorch dtype.
Source code in quadra/models/evaluation.py
319 320 321 |
|
cpu()
¶
Move model to cpu.
Source code in quadra/models/evaluation.py
315 316 317 |
|
eval()
¶
Fake interface to match torch models.
Source code in quadra/models/evaluation.py
307 308 309 |
|
generate_session_options()
¶
Generate session options from the current config.
Source code in quadra/models/evaluation.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
|
half()
¶
Convert model to half precision.
Source code in quadra/models/evaluation.py
311 312 313 |
|
load_from_disk(model_path, device='cpu')
¶
Load model from disk.
Source code in quadra/models/evaluation.py
273 274 275 276 277 278 279 280 281 |
|
to(device)
¶
Move model to device.
Source code in quadra/models/evaluation.py
301 302 303 304 305 |
|
TorchEvaluationModel(config, model_architecture)
¶
Bases: TorchscriptEvaluationModel
Wrapper for torch models.
Parameters:
-
model_architecture
(
Module
) –Optional torch model architecture
Source code in quadra/models/evaluation.py
134 135 136 137 138 139 |
|
load_from_disk(model_path, device='cpu')
¶
Load model from disk.
Source code in quadra/models/evaluation.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
|
TorchscriptEvaluationModel
¶
Bases: BaseEvaluationModel
Wrapper for torchscript models.
training: bool
property
¶
Return whether model is in training mode.
cpu()
¶
Move model to cpu.
Source code in quadra/models/evaluation.py
122 123 124 |
|
eval()
¶
Set model to evaluation mode.
Source code in quadra/models/evaluation.py
109 110 111 |
|
half()
¶
Convert model to half precision.
Source code in quadra/models/evaluation.py
118 119 120 |
|
load_from_disk(model_path, device='cpu')
¶
Load model from disk.
Source code in quadra/models/evaluation.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
to(device)
¶
Move model to device.
Source code in quadra/models/evaluation.py
104 105 106 107 |
|