Freeze a model

6.1. Freeze a model#

The trained neural network is extracted from a checkpoint and dumped into a model file. This process is called “freezing” a model. To freeze a model, typically one does

$ dp freeze -o model.pb

in the folder where the model is trained. The output model is called model.pb. The idea and part of our code are from Morgan.

$ dp --pt freeze -o model.pth

in the folder where the model is trained. The output model is called model.pth.

In multi-task mode, you need to choose one available heads (e.g. CHOSEN_BRANCH) by --head to specify which model branch you want to freeze:

$ dp --pt freeze -o model_branch1.pth --head CHOSEN_BRANCH

The output model is called model_branch1.pth, which is the specifically frozen model with the CHOSEN_BRANCH head.