Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/Microsoft.Extensions.ML/Builder/BuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public static class BuilderExtensions
/// <returns>
/// The updated <see cref="PredictionEnginePoolBuilder{TData, TPrediction}"/>.
/// </returns>
/// <remarks>Only add models from trusted sources. Adding models from untrusted sources is a security risk.</remarks>
public static PredictionEnginePoolBuilder<TData, TPrediction> FromUri<TData, TPrediction>(
this PredictionEnginePoolBuilder<TData, TPrediction> builder, string uri)
where TData : class
Expand All @@ -41,6 +42,7 @@ public static PredictionEnginePoolBuilder<TData, TPrediction> FromUri<TData, TPr
/// <returns>
/// The updated <see cref="PredictionEnginePoolBuilder{TData, TPrediction}"/>.
/// </returns>
/// <remarks>Only add models from trusted sources. Adding models from untrusted sources is a security risk.</remarks>
public static PredictionEnginePoolBuilder<TData, TPrediction> FromUri<TData, TPrediction>(
this PredictionEnginePoolBuilder<TData, TPrediction> builder, string modelName, string uri)
where TData : class
Expand All @@ -62,6 +64,7 @@ public static PredictionEnginePoolBuilder<TData, TPrediction> FromUri<TData, TPr
/// <returns>
/// The updated <see cref="PredictionEnginePoolBuilder{TData, TPrediction}"/>.
/// </returns>
/// <remarks>Only add models from trusted sources. Adding models from untrusted sources is a security risk.</remarks>
public static PredictionEnginePoolBuilder<TData, TPrediction> FromUri<TData, TPrediction>(
this PredictionEnginePoolBuilder<TData, TPrediction> builder, string modelName, Uri uri)
where TData : class where TPrediction : class, new()
Expand All @@ -80,6 +83,7 @@ public static PredictionEnginePoolBuilder<TData, TPrediction> FromUri<TData, TPr
/// <returns>
/// The updated <see cref="PredictionEnginePoolBuilder{TData, TPrediction}"/>.
/// </returns>
/// <remarks>Only add models from trusted sources. Adding models from untrusted sources is a security risk.</remarks>
public static PredictionEnginePoolBuilder<TData, TPrediction> FromUri<TData, TPrediction>(
this PredictionEnginePoolBuilder<TData, TPrediction> builder, string uri, TimeSpan period)
where TData : class where TPrediction : class, new()
Expand All @@ -103,6 +107,7 @@ public static PredictionEnginePoolBuilder<TData, TPrediction> FromUri<TData, TPr
/// <returns>
/// The updated <see cref="PredictionEnginePoolBuilder{TData, TPrediction}"/>.
/// </returns>
/// <remarks>Only add models from trusted sources. Adding models from untrusted sources is a security risk.</remarks>
public static PredictionEnginePoolBuilder<TData, TPrediction> FromUri<TData, TPrediction>(
this PredictionEnginePoolBuilder<TData, TPrediction> builder, string modelName, string uri, TimeSpan period)
where TData : class
Expand All @@ -127,6 +132,7 @@ public static PredictionEnginePoolBuilder<TData, TPrediction> FromUri<TData, TPr
/// <returns>
/// The updated <see cref="PredictionEnginePoolBuilder{TData, TPrediction}"/>.
/// </returns>
/// <remarks>Only add models from trusted sources. Adding models from untrusted sources is a security risk.</remarks>
public static PredictionEnginePoolBuilder<TData, TPrediction> FromUri<TData, TPrediction>(
this PredictionEnginePoolBuilder<TData, TPrediction> builder, string modelName, Uri uri, TimeSpan period)
where TData : class
Expand All @@ -150,6 +156,7 @@ public static PredictionEnginePoolBuilder<TData, TPrediction> FromUri<TData, TPr
/// <returns>
/// The updated <see cref="PredictionEnginePoolBuilder{TData, TPrediction}"/>.
/// </returns>
/// <remarks>Only add models from trusted sources. Adding models from untrusted sources is a security risk.</remarks>
public static PredictionEnginePoolBuilder<TData, TPrediction> FromFile<TData, TPrediction>(
this PredictionEnginePoolBuilder<TData, TPrediction> builder, string filePath)
where TData : class
Expand All @@ -169,6 +176,7 @@ public static PredictionEnginePoolBuilder<TData, TPrediction> FromFile<TData, TP
/// <returns>
/// The updated <see cref="PredictionEnginePoolBuilder{TData, TPrediction}"/>.
/// </returns>
/// <remarks>Only add models from trusted sources. Adding models from untrusted sources is a security risk.</remarks>
public static PredictionEnginePoolBuilder<TData, TPrediction> FromFile<TData, TPrediction>(
this PredictionEnginePoolBuilder<TData, TPrediction> builder, string filePath, bool watchForChanges)
where TData : class
Expand All @@ -190,6 +198,7 @@ public static PredictionEnginePoolBuilder<TData, TPrediction> FromFile<TData, TP
/// <returns>
/// The updated <see cref="PredictionEnginePoolBuilder{TData, TPrediction}"/>.
/// </returns>
/// <remarks>Only add models from trusted sources. Adding models from untrusted sources is a security risk.</remarks>
public static PredictionEnginePoolBuilder<TData, TPrediction> FromFile<TData, TPrediction>(
this PredictionEnginePoolBuilder<TData, TPrediction> builder, string modelName, string filePath)
where TData : class
Expand All @@ -214,6 +223,7 @@ public static PredictionEnginePoolBuilder<TData, TPrediction> FromFile<TData, TP
/// <returns>
/// The updated <see cref="PredictionEnginePoolBuilder{TData, TPrediction}"/>.
/// </returns>
/// <remarks>Only add models from trusted sources. Adding models from untrusted sources is a security risk.</remarks>
public static PredictionEnginePoolBuilder<TData, TPrediction> FromFile<TData, TPrediction>(
this PredictionEnginePoolBuilder<TData, TPrediction> builder, string modelName, string filePath, bool watchForChanges)
where TData : class
Expand Down
4 changes: 4 additions & 0 deletions src/Microsoft.ML.Data/Model/ModelOperationsCatalog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ private void SaveInputSchema(DataViewSchema inputSchema, RepositoryWriter rep)
/// <param name="inputSchema">Will contain the input schema for the model. If the model was saved without
/// any description of the input, there will be no input schema. In this case this can be <see langword="null"/>.</param>
/// <returns>The loaded model.</returns>
/// <remarks>Only load models from trusted sources. Loading models from untrusted sources is a security risk.</remarks>
/// <example>
/// <format type="text/markdown">
/// <![CDATA[
Expand Down Expand Up @@ -201,6 +202,7 @@ public ITransformer Load(Stream stream, out DataViewSchema inputSchema)
/// <param name="inputSchema">Will contain the input schema for the model. If the model was saved without
/// any description of the input, there will be no input schema. In this case this can be <see langword="null"/>.</param>
/// <returns>The loaded model.</returns>
/// <remarks>Only load models from trusted sources. Loading models from untrusted sources is a security risk.</remarks>
/// <example>
/// <format type="text/markdown">
/// <![CDATA[
Expand Down Expand Up @@ -255,6 +257,7 @@ private ITransformer DecomposeLoader(ref IDataLoader<IMultiStreamSource> loader)
/// this method will throw an exception. The scenario where no loader is stored in the stream should
/// be handled instead using the <see cref="Load(Stream, out DataViewSchema)"/> method.</param>
/// <returns>The transformer model from the model stream.</returns>
/// <remarks>Only load models from trusted sources. Loading models from untrusted sources is a security risk.</remarks>
public ITransformer LoadWithDataLoader(Stream stream, out IDataLoader<IMultiStreamSource> loader)
{
_env.CheckValue(stream, nameof(stream));
Expand Down Expand Up @@ -283,6 +286,7 @@ public ITransformer LoadWithDataLoader(Stream stream, out IDataLoader<IMultiStre
/// this method will throw an exception. The scenario where no loader is stored in the stream should
/// be handled instead using the <see cref="Load(Stream, out DataViewSchema)"/> method.</param>
/// <returns>The transformer model from the model file.</returns>
/// <remarks>Only load models from trusted sources. Loading models from untrusted sources is a security risk.</remarks>
public ITransformer LoadWithDataLoader(string filePath, out IDataLoader<IMultiStreamSource> loader)
{
_env.CheckNonEmpty(filePath, nameof(filePath));
Expand Down
30 changes: 30 additions & 0 deletions src/Microsoft.ML.OnnxTransformer/OnnxCatalog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public static class OnnxCatalog
/// The name/type of input columns must exactly match name/type of the ONNX model inputs.
/// The name/type of the produced output columns will match name/type of the ONNX model outputs.
/// If the gpuDeviceId value is <see langword="null" /> the <see cref="P:MLContext.GpuDeviceId"/> value will be used if it is not <see langword="null" />.
///
/// Only apply models from trusted sources. Applying models from untrusted sources is a security risk.
/// </remarks>
/// <param name="catalog">The transform's catalog.</param>
/// <param name="modelFile">The path of the file containing the ONNX model.</param>
Expand Down Expand Up @@ -51,6 +53,8 @@ public static OnnxScoringEstimator ApplyOnnxModel(this TransformsCatalog catalog
/// The name/type of input columns must exactly match name/type of the ONNX model inputs.
/// The name/type of the produced output columns will match name/type of the ONNX model outputs.
/// If the gpuDeviceId value is <see langword="null" /> the <see cref="P:MLContext.GpuDeviceId"/> value will be used if it is not <see langword="null" />.
///
/// Only apply models from trusted sources. Applying models from untrusted sources is a security risk.
/// </remarks>
/// <param name="catalog">The transform's catalog.</param>
/// <param name="modelBytes">The <see cref="System.IO.Stream"/> containing the model bytes.</param>
Expand Down Expand Up @@ -79,6 +83,8 @@ public static OnnxScoringEstimator ApplyOnnxModel(this TransformsCatalog catalog
/// The name/type of input columns must exactly match name/type of the ONNX model inputs.
/// The name/type of the produced output columns will match name/type of the ONNX model outputs.
/// If the gpuDeviceId value is <see langword="null" /> the <see cref="P:MLContext.GpuDeviceId"/> value will be used if it is not <see langword="null" />.
///
/// Only apply models from trusted sources. Applying models from untrusted sources is a security risk.
/// </remarks>
/// <param name="catalog">The transform's catalog.</param>
/// <param name="modelFile">The path of the file containing the ONNX model.</param>
Expand Down Expand Up @@ -115,6 +121,8 @@ public static OnnxScoringEstimator ApplyOnnxModel(this TransformsCatalog catalog
/// The name/type of input columns must exactly match name/type of the ONNX model inputs.
/// The name/type of the produced output columns will match name/type of the ONNX model outputs.
/// If the gpuDeviceId value is <see langword="null" /> the <see cref="P:MLContext.GpuDeviceId"/> value will be used if it is not <see langword="null" />.
///
/// Only apply models from trusted sources. Applying models from untrusted sources is a security risk.
/// </remarks>
/// <param name="catalog">The transform's catalog.</param>
/// <param name="modelBytes">The <see cref="System.IO.Stream"/> containing the model bytes.</param>
Expand Down Expand Up @@ -154,6 +162,8 @@ public static OnnxScoringEstimator ApplyOnnxModel(this TransformsCatalog catalog
/// <param name="fallbackToCpu">If GPU error, raise exception or fallback to CPU.</param>
/// <remarks>
/// If the gpuDeviceId value is <see langword="null" /> the <see cref="P:MLContext.GpuDeviceId"/> value will be used if it is not <see langword="null" />.
///
/// Only apply models from trusted sources. Applying models from untrusted sources is a security risk.
/// </remarks>
/// <example>
/// <format type="text/markdown">
Expand Down Expand Up @@ -186,6 +196,8 @@ public static OnnxScoringEstimator ApplyOnnxModel(this TransformsCatalog catalog
/// <param name="fallbackToCpu">If GPU error, raise exception or fallback to CPU.</param>
/// <remarks>
/// If the gpuDeviceId value is <see langword="null" /> the <see cref="P:MLContext.GpuDeviceId"/> value will be used if it is not <see langword="null" />.
///
/// Only apply models from trusted sources. Applying models from untrusted sources is a security risk.
/// </remarks>
/// <example>
/// <format type="text/markdown">
Expand All @@ -212,6 +224,8 @@ public static OnnxScoringEstimator ApplyOnnxModel(this TransformsCatalog catalog
/// </summary>
/// <remarks>
/// If the options.GpuDeviceId value is <see langword="null" /> the <see cref="P:MLContext.GpuDeviceId"/> value will be used if it is not <see langword="null" />.
///
/// Only apply models from trusted sources. Applying models from untrusted sources is a security risk.
/// </remarks>
/// <param name="catalog">The transform's catalog.</param>
/// <param name="options">Options for the <see cref="OnnxScoringEstimator"/>.</param>
Expand Down Expand Up @@ -239,6 +253,8 @@ public static OnnxScoringEstimator ApplyOnnxModel(this TransformsCatalog catalog
/// <param name="fallbackToCpu">If GPU error, raise exception or fallback to CPU.</param>
/// <remarks>
/// If the gpuDeviceId value is <see langword="null" /> the <see cref="P:MLContext.GpuDeviceId"/> value will be used if it is not <see langword="null" />.
///
/// Only apply models from trusted sources. Applying models from untrusted sources is a security risk.
/// </remarks>
/// <example>
/// <format type="text/markdown">
Expand Down Expand Up @@ -277,6 +293,8 @@ public static OnnxScoringEstimator ApplyOnnxModel(this TransformsCatalog catalog
/// <param name="fallbackToCpu">If GPU error, raise exception or fallback to CPU.</param>
/// <remarks>
/// If the gpuDeviceId value is <see langword="null" /> the <see cref="P:MLContext.GpuDeviceId"/> value will be used if it is not <see langword="null" />.
///
/// Only apply models from trusted sources. Applying models from untrusted sources is a security risk.
/// </remarks>
/// <example>
/// <format type="text/markdown">
Expand Down Expand Up @@ -311,6 +329,8 @@ public static OnnxScoringEstimator ApplyOnnxModel(this TransformsCatalog catalog
/// <param name="fallbackToCpu">If GPU error, raise exception or fallback to CPU.</param>
/// <remarks>
/// If the gpuDeviceId value is <see langword="null" /> the <see cref="P:MLContext.GpuDeviceId"/> value will be used if it is not <see langword="null" />.
///
/// Only apply models from trusted sources. Applying models from untrusted sources is a security risk.
/// </remarks>
public static OnnxScoringEstimator ApplyOnnxModel(this TransformsCatalog catalog,
string[] outputColumnNames,
Expand All @@ -336,6 +356,8 @@ public static OnnxScoringEstimator ApplyOnnxModel(this TransformsCatalog catalog
/// <param name="fallbackToCpu">If GPU error, raise exception or fallback to CPU.</param>
/// <remarks>
/// If the gpuDeviceId value is <see langword="null" /> the <see cref="P:MLContext.GpuDeviceId"/> value will be used if it is not <see langword="null" />.
///
/// Only apply models from trusted sources. Applying models from untrusted sources is a security risk.
/// </remarks>
public static OnnxScoringEstimator ApplyOnnxModel(this TransformsCatalog catalog,
string[] outputColumnNames,
Expand Down Expand Up @@ -365,6 +387,8 @@ public static OnnxScoringEstimator ApplyOnnxModel(this TransformsCatalog catalog
/// <param name="fallbackToCpu">If GPU error, raise exception or fallback to CPU.</param>
/// <remarks>
/// If the gpuDeviceId value is <see langword="null" /> the <see cref="P:MLContext.GpuDeviceId"/> value will be used if it is not <see langword="null" />.
///
/// Only apply models from trusted sources. Applying models from untrusted sources is a security risk.
/// </remarks>
public static OnnxScoringEstimator ApplyOnnxModel(this TransformsCatalog catalog,
string[] outputColumnNames,
Expand Down Expand Up @@ -395,6 +419,8 @@ public static OnnxScoringEstimator ApplyOnnxModel(this TransformsCatalog catalog
/// <param name="fallbackToCpu">If GPU error, raise exception or fallback to CPU.</param>
/// <remarks>
/// If the gpuDeviceId value is <see langword="null" /> the <see cref="P:MLContext.GpuDeviceId"/> value will be used if it is not <see langword="null" />.
///
/// Only apply models from trusted sources. Applying models from untrusted sources is a security risk.
/// </remarks>
public static OnnxScoringEstimator ApplyOnnxModel(this TransformsCatalog catalog,
string[] outputColumnNames,
Expand Down Expand Up @@ -426,6 +452,8 @@ public static OnnxScoringEstimator ApplyOnnxModel(this TransformsCatalog catalog
/// <param name="recursionLimit">Optional, specifies the Protobuf CodedInputStream recursion limit. Default value is 100.</param>
/// <remarks>
/// If the gpuDeviceId value is <see langword="null" /> the <see cref="P:MLContext.GpuDeviceId"/> value will be used if it is not <see langword="null" />.
///
/// Only apply models from trusted sources. Applying models from untrusted sources is a security risk.
/// </remarks>
public static OnnxScoringEstimator ApplyOnnxModel(this TransformsCatalog catalog,
string[] outputColumnNames,
Expand Down Expand Up @@ -458,6 +486,8 @@ public static OnnxScoringEstimator ApplyOnnxModel(this TransformsCatalog catalog
/// <param name="recursionLimit">Optional, specifies the Protobuf CodedInputStream recursion limit. Default value is 100.</param>
/// <remarks>
/// If the gpuDeviceId value is <see langword="null" /> the <see cref="P:MLContext.GpuDeviceId"/> value will be used if it is not <see langword="null" />.
///
/// Only apply models from trusted sources. Applying models from untrusted sources is a security risk.
/// </remarks>
public static OnnxScoringEstimator ApplyOnnxModel(this TransformsCatalog catalog,
string[] outputColumnNames,
Expand Down
2 changes: 2 additions & 0 deletions src/Microsoft.ML.TensorFlow/TensorflowCatalog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public static class TensorflowCatalog
/// </summary>
/// <param name="catalog">The transform's catalog.</param>
/// <param name="modelLocation">Location of the TensorFlow model.</param>
/// <remarks>Only load models from trusted sources. Loading models from untrusted sources is a security risk.</remarks>
/// <example>
/// <format type="text/markdown">
/// <![CDATA[
Expand All @@ -52,6 +53,7 @@ public static TensorFlowModel LoadTensorFlowModel(this ModelOperationsCatalog ca
/// <param name="catalog">The transform's catalog.</param>
/// <param name="modelLocation">Location of the TensorFlow model.</param>
/// <param name="treatOutputAsBatched">If the first dimension of the output is unknown, should it be treated as batched or not.</param>
/// <remarks>Only load models from trusted sources. Loading models from untrusted sources is a security risk.</remarks>
/// <example>
/// <format type="text/markdown">
/// <![CDATA[
Expand Down
Loading