writers
#
WRITERS:
Output functions for run-fit
Functions:
-
write_scatter–Predict and save energies/forces to HDF5.
-
report–Report training progress for Levenberg-Marquardt optimizer.
write_scatter
#
write_scatter(
dataset: Dataset,
force_field: TensorForceField,
topology_in: TensorTopology,
device_type: str,
filename: PathLike,
) -> tuple[float, float, float, float]
Predict and save energies/forces to HDF5.
Source code in presto/writers.py
report
#
report(
step: int,
x: Tensor,
loss: Tensor,
gradient: Tensor,
hessian: Tensor,
step_quality: float,
accept_step: bool,
trainable: Trainable,
topologies: list[TensorTopology],
datasets_train: list[Dataset],
datasets_test: list[Dataset],
initial_parameters: Tensor,
regularisation_target: Literal["initial", "zero"],
metrics_file: PathLike,
experiment_dir: Path,
) -> None
Report training progress for Levenberg-Marquardt optimizer.
This function computes training and test losses using the same loss computation as train_adam (via compute_overall_loss_and_grad) to ensure consistent metrics reporting.
Args: step: Current optimization step. x: Current trainable parameters. loss: Loss value from the optimizer (not used, we recompute for consistency). gradient: Gradient tensor (not used in reporting). hessian: Hessian tensor (not used in reporting). step_quality: Quality measure of the step (not used in reporting). accept_step: Whether the step was accepted (not used in reporting). trainable: The trainable object containing the force field. topologies: List of topologies for all molecules. datasets_train: List of training datasets for all molecules. datasets_test: List of test datasets for all molecules. initial_parameters: Initial parameters for regularization. regularisation_target: Regularization target ('initial' or 'zero'). metrics_file: Path to the metrics output file. experiment_dir: Path to the TensorBoard experiment directory.