init
Function
Initializes the Rec SDK model training framework.
Prototype
1 | def init(**kwargs) |
**kwargs Parameters
- When sess.run is used for training, the number of steps for sess to perform train/eval/save must be the same as the value of train_steps/eval_steps/save_steps.
- When Estimator is used for training:
- The value of save_steps must be the same as that of save_checkpoints_steps when the NPURunConfig object is defined, and cannot be set to –1 in TensorFlow.
- The value of max_steps must be the same as that of max_steps passed to est.train()/tf.estimator.TrainSpec(), and cannot be set to –1 in TensorFlow.
- In train_and_evaluate mode, the requirements for save_steps and max_steps are the same as those described above. The value of train_steps must be the same as that of save_steps. The value of eval_steps must be the same as that of steps passed to tf.estimator.EvalSpec(), and cannot be set to –1 in TensorFlow.
- If kwargs is used to pass other parameters that are not described, Rec SDK does not use these parameters.
- Use the actual values of max_steps, train steps, and eval steps, and their values cannot be 0 at the same time.
- If use_dynamic_expansion is set to True, select an optimizer of the ByAddr type, such as SGDByAddr and LazyAdamByAddress.
- Multi-round evaluation is not supported in the train_and_evaluate scenario.
- The values of max_steps, train_steps, eval_steps, and save_steps must be the same as those in the actual training process. If they are inconsistent, the training may fail or the training accuracy may be affected.
Return Value
- Success: None
- Failure: An exception is thrown.
Example
1 2 | from mx_rec.util.initialize import init init(max_steps=200, train_steps=100, eval_steps=10, save_steps=100, use_dynamic=True, use_dynamic_expansion=False) |
See Also
For details about the API call sequence and example, see Porting and Training.