How to load checkpoint and perform inference with Solver class using checkpoint

Hi! I ran the bracket example of linear elasticity in modulus, modifying it using a PointVTKInferencer to get the predictions on the 3D geometry defined in a file .vtk. After training, displaying the results, I wanted to make the mesh thicker, I didn’t want to relaunch the training but to define a new level of inference and to use the model pre trained. I saw it can be done with the Solver.eval() method, however, assuming I wanted to make inference later, I wanted to reload the trained network and call up the method, but I am not able to determine Solver functions that allow me to load the network or checkpoints, which are saved in the output folder in .pth format, if I’m not mistaken. Is there a way to do that?

This is the code:

vtk_obj = VTKFromFile(
    to_absolute_path("./bracket.vtk"), # Legacy VTK files supported
    export_map={"U_pred": ["u", "v", "w"], "Sigma_xx": ["sigma_xx"], "Sigma_yy": ["sigma_yy"], "Sigma_zz": ["sigma_zz"],
                "Sigma_xy": ["sigma_xy"], "Sigma_xz": ["sigma_xz"], "Sigma_yz": ["sigma_yz"]}
)
 
 
voxel_inferencer = PointVTKInferencer(
    vtk_obj = vtk_obj,
    nodes=nodes,
    input_vtk_map={"x": "x", "y": "y", "z": "z"},
    output_names=["u", "v", "w", "sigma_xx", "sigma_yy", "sigma_zz", "sigma_xy", "sigma_xz", "sigma_yz"],
    batch_size=4096,
)
domain.add_inferencer(voxel_inferencer, "inf_data")

slv = Solver(cfg, domain)
slv.solve() #training

slv.eval() #inference after training

#inference at a later time, reloading the net weights?

Hi,
if I understand you correctly, you need to run the Solver in “eval” mode.

The details are described here:
Modulus Sym Configuration - NVIDIA Docs
Just search for: “Run Modes”

Hope this helps!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.