6.1. Freeze a model

The trained neural network is extracted from a checkpoint and dumped into a protobuf(.pb) file. This process is called “freezing” a model. The idea and part of our code are from Morgan. 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.

$ 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.