Skip to content

Commit 92d280c

Browse files
authored
correct for_inference as training
1 parent 1e4aea5 commit 92d280c

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

python/paddle/incubate/hapi/model.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -855,17 +855,17 @@ def save(self, path, training=True):
855855
"""
856856
This function saves parameters, optimizer information or model and
857857
paramters only for inference to path. It depends on the parameter
858-
`for_inference`.
858+
`training`.
859859
860-
If `for_inference` is set to False, the parameters saved contain all
860+
If `training` is set to True, the parameters saved contain all
861861
the trainable Variable, will save to a file with suffix ".pdparams".
862862
The optimizer information contains all the variable used by optimizer.
863863
For Adam optimizer, contains beta1, beta2, momentum etc. All the
864864
information will save to a file with suffix ".pdopt". (If the optimizer
865865
have no variable need to save (like SGD), the fill will not generated).
866866
This function will silently overwrite existing file at the target location.
867867
868-
If `for_inference` is set to True, only inference model will be saved. It
868+
If `training` is set to False, only inference model will be saved. It
869869
should be noted that before using `save`, you should run the model, and
870870
the shape of input you saved is as same as the input of its running.
871871
`@paddle.jit.to_static` must be added on `forward` function of your layer
@@ -921,7 +921,7 @@ def forward(self, x):
921921
"""
922922

923923
if ParallelEnv().local_rank == 0:
924-
if for_inference:
924+
if not training:
925925
self._save_inference_model(path)
926926
else:
927927
self._adapter.save(path)

0 commit comments

Comments
 (0)