Skip to content

Commit

Permalink
updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
carzh committed Jul 22, 2024
1 parent 26dc4ec commit 702e8b9
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,10 @@ public void OptimizerStep(RunOptions options)
/// an inference model if it knows the inference graph outputs. The input inference graph outputs
/// are used to prune the eval model so that the inference model's outputs align with the provided outputs.
/// The exported model is saved at the path provided and can be used for inferencing with InferenceSession.
/// Note that the function re-loads the eval model from the path provided to TrainingSession
/// and expects that this path still be valid.
///
/// This function modifies the eval graph in-place, so after this method is called, the TrainingSession can
/// no longer be used for training. In order to continue training from this point, save the checkpoint state
/// and create a new TrainingSession with the saved checkpoint state.
/// </summary>
/// <param name="inferenceModelPath">Path where the inference model should be serialized to.</param>
/// <param name="graphOutputNames">Names of the outputs that are needed in the inference model.</param>
Expand Down
5 changes: 3 additions & 2 deletions java/src/main/java/ai/onnxruntime/OrtTrainingSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -998,8 +998,9 @@ private native void schedulerStep(long apiHandle, long trainingApiHandle, long n
* Exports the evaluation model as a model suitable for inference, setting the desired nodes as
* output nodes.
*
* <p>Note that this method reloads the evaluation model from the path provided to the training
* session, and this path must still be valid.
* <p>Note that this method modifies the eval session in-place; thus, after this method is called, the
* OrtTrainingSession can no longer be trained with. To continue training from this point, save the checkpoint
* and then load it into a new OrtTrainingSession.
*
* @param outputPath The path to write out the inference model.
* @param outputNames The names of the output nodes.
Expand Down
7 changes: 4 additions & 3 deletions objectivec/include/ort_training_session.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,11 @@ NS_ASSUME_NONNULL_BEGIN
*
* If the training session was provided with an eval model, the training session can generate an inference model if it
* knows the inference graph outputs. The input inference graph outputs are used to prune the eval model so that the
* inference model's outputs align with the provided outputs. The exported model is saved at the path provided and
* can be used for inferencing with `ORTSession`.
* inference model's outputs align with the provided outputs.
*
* @note The method reloads the eval model from the path provided to the initializer and expects this path to be valid.
* @note This method modifies the eval model graph in-place, so after this method is called, the ORTTrainingSession
* can no longer be used for training. To resume training from this point, save the checkpoint state and create a new
* ORTTrainingSession with the saved checkpoint state.
*
* @param inferenceModelPath The path to the serialized the inference model.
* @param graphOutputNames The names of the outputs that are needed in the inference model.
Expand Down
5 changes: 4 additions & 1 deletion orttraining/orttraining/python/training/api/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,12 @@ def export_model_for_inferencing(
Once training is complete, this function can be used to drop the training specific nodes in the onnx model.
In particular, this function does the following:
- Parse over the training graph and identify nodes that generate the given output names.
- Parse over the eval graph and identify nodes that generate the given output names.
- Drop all subsequent nodes in the graph since they are not relevant to the inference graph.
Once this method is called, training is considered complete and the module can no longer be used for training.
To resume training from this point, save the checkpoint and create a new module from the checkpoint.
Args:
inference_model_uri: The path to the inference model.
graph_output_names: The list of output names that are required for inferencing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,8 +513,9 @@ struct OrtTrainingApi {
* an inference model if it knows the inference graph outputs. The input inference graph outputs
* are used to prune the eval model so that the inference model's outputs align with the provided outputs.
* The exported model is saved at the path provided and can be used for inferencing with InferenceSession.
* \note Note that the function re-loads the eval model from the path provided to OrtTrainingApi::CreateTrainingSession
* and expects that this path still be valid.
* \note Note that the function modifies the eval model graph in-place, so after this method is called, the
* OrtTrainingSession can no longer be used for training. To resume training from this point, save the checkpoint
* state and create a new OrtTrainingSession with the updated eval model.
*
* \param[in] sess The `this` pointer to the training session.
* \param[in] inference_model_path Path where the inference model should be serialized to.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,9 @@ class TrainingSession : public detail::Base<OrtTrainingSession> {
* an inference model if it knows the inference graph outputs. The input inference graph outputs
* are used to prune the eval model so that the inference model's outputs align with the provided outputs.
* The exported model is saved at the path provided and can be used for inferencing with Ort::Session.
* \note Note that the function re-loads the eval model from the path provided to Ort::TrainingSession
* and expects that this path still be valid.
* \note Note that the function modifies the eval model graph in-place, so after this method is called, the
* OrtTrainingSession can no longer be used for training. To resume training from this point, save the checkpoint
* state and create a new OrtTrainingSession with the updated eval model.
*
* \param[in] inference_model_path Path where the inference model should be serialized to.
* \param[in] graph_output_names Names of the outputs that are needed in the inference model.
Expand Down

0 comments on commit 702e8b9

Please sign in to comment.