model_to_npu_estimator
Description
Converts the model constructed by using Keras to an NPUEstimator object.
Prototype
def model_to_npu_estimator(keras_model=None, keras_model_path=None, custom_objects=None, model_dir=None, checkpoint_format='saver', config=None, job_start_file='')
Options
Option |
Description |
|---|---|
keras_model |
Built Keras model object. This option and keras_model_path are mutually exclusive. |
keras_model_path |
Path for storing the built Keras model on the drive. You can use the save() method of the Keras model to generate a Keras model in HDF5 format. This option and keras_model are mutually exclusive. |
custom_objects |
Dictionary of user-defined objects. If a user-defined layer or function is used during Keras construction, custom_objects must be used during model loading. |
model_dir |
Model directory, which is used to save or restore model files. If this option is not set, the value of model_dir in the config file is used. If both options are set, the values of the two options must be the same. If both options are set to None, the temporary directory /tmp is used. |
checkpoint_format |
Sets the format of the checkpoint file saved by NPUEstimator during training.
|
config |
NPURunConfig class object, which is used to configure NPUEstimator running parameters. For details about the constructor of the NPURunConfig class, see NPURunConfig Constructor. |
job_start_file |
Path of the configuration file used to start the training process in the CSA scenario. |
Returns
An NPUEstimator object is returned based on the input Keras model.
Restrictions
Currently, only the function model and sequence model (Keras graph construction mode) can be converted into an NPUEstimator object using the model_to_npu_estimator API.