Evaluating a model

metatensor.models.utils.evaluate_model.evaluate_model(model: Module | RecursiveScriptModule, systems: List[System], targets: Dict[str, TargetInfo], is_training: bool) Dict[str, TensorMap][source]

Evaluate the model (in training or exported) on a set of requested targets.

Parameters:
  • model (Module | RecursiveScriptModule) – The model to use. This can either be a model in training (torch.nn.Module) or an exported model (torch.jit._script.RecursiveScriptModule).

  • systems (List[System]) – The systems to use.

  • targets (Dict[str, TargetInfo]) – The names of the targets to evaluate (keys), along with their associated gradients (values).

  • is_training (bool) – Whether the model is being computed during training.

Returns:

The predictions of the model for the requested targets.

Return type:

Dict[str, TensorMap]