Once I have trained the model, how do I access the model itself? So, once it has finished training, how would I plug in values for variables trained on into this model?
Your model is saved in a model checkpoint file located in your
outputs folder near your training script. With the model checkpoint you load it a python script and it can use it for what you would like. You could do this via the Modulus framework or fall back to a more native PyTorch route.
There are a couple of ways, the first “Modulus workflow” approach is using the evaluate mode built into the solver: solver.eval(). This will just run any inferencer / validators you’ve added. See the _eval function in the trainer: https://gitlab.com/nvidia/modulus/modulus/-/blob/release_22.09/modulus/trainer.py#L749
Alternatively you could look at loading the model checkpoint manually using a Modulus model. This checkpoint is saved in the outputs folder of your run. Then running …
The Link is not available. Is it still up to date?
Updated link now on Github:
# Graph replay
# take optimizer step
return self.loss_static, self.losses_static
# check the directory exists
if not os.path.exists(self.network_dir):
raise RuntimeError("Network checkpoint is required for eval mode.")
# create global model for restoring and saving
self.saveable_models = self.get_saveable_models()
You can also set
run_mode: 'eval' in your config YAML.