From 8301e2c189185d2196b331c7d280c92c0be91ac0 Mon Sep 17 00:00:00 2001 From: Baiju Meswani Date: Fri, 21 Feb 2025 10:28:03 -0800 Subject: [PATCH] Revert "Improve C# documentation" (#1270) --- src/csharp/Adapters.cs | 31 ++++++------- src/csharp/Config.cs | 44 ++---------------- src/csharp/Exceptions.cs | 5 +- src/csharp/Generator.cs | 77 ++++++------------------------- src/csharp/GeneratorParams.cs | 49 -------------------- src/csharp/Images.cs | 5 +- src/csharp/Model.cs | 15 ------ src/csharp/MultiModalProcessor.cs | 42 ----------------- src/csharp/Result.cs | 2 +- src/csharp/Sequences.cs | 9 ---- src/csharp/Tensor.cs | 44 +----------------- src/csharp/Tokenizer.cs | 60 ------------------------ src/csharp/TokenizerStream.cs | 13 ------ src/csharp/Utils.cs | 10 +--- 14 files changed, 38 insertions(+), 368 deletions(-) diff --git a/src/csharp/Adapters.cs b/src/csharp/Adapters.cs index c8fc39c1b..4ef6cabfc 100644 --- a/src/csharp/Adapters.cs +++ b/src/csharp/Adapters.cs @@ -12,39 +12,34 @@ namespace Microsoft.ML.OnnxRuntimeGenAI public class Adapters : SafeHandle { /// - /// Constructs an Adapters object with the given model. + /// Creates a container for adapters + /// used to load, unload and hold them. + /// Throws on error. /// /// Reference to a loaded model - /// - /// Thrown when the call to the GenAI native API fails. - /// + /// new Adapters object public Adapters(Model model) : base(IntPtr.Zero, true) { Result.VerifySuccess(NativeMethods.OgaCreateAdapters(model.Handle, out handle)); } /// - /// Loads the model adapter from the given adapter file path and adapter name. + /// Method that loads adapter data and assigns it a nmae that + /// it can be referred to. Throws on error. /// - /// The path of the adapter. - /// A unique user supplied adapter identifier. - /// - /// Thrown when the call to the GenAI native API fails. - /// - public void LoadAdapter(string adapterFilePath, string adapterName) + /// file path to load + /// adapter name + public void LoadAdapter(string adapterPath, string adapterName) { Result.VerifySuccess(NativeMethods.OgaLoadAdapter(handle, - StringUtils.ToUtf8(adapterFilePath), StringUtils.ToUtf8(adapterName))); + StringUtils.ToUtf8(adapterPath), StringUtils.ToUtf8(adapterName))); } /// - /// Unloads the adapter with the given identifier from the previosly loaded adapters. If the - /// adapter is not found, or if it cannot be unloaded (when it is in use), an error is returned. + /// Unload the adatper that was loaded by the LoadAdapter method. + /// Throws on error. /// /// - /// - /// Thrown when the call to the GenAI native API fails. - /// public void UnloadAdapter(string adapterName) { Result.VerifySuccess(NativeMethods.OgaUnloadAdapter(handle, StringUtils.ToUtf8(adapterName))); @@ -53,7 +48,7 @@ public void UnloadAdapter(string adapterName) internal IntPtr Handle { get { return handle; } } /// - /// Implement SafeHandle override. + /// Implement SafeHandle override /// public override bool IsInvalid => handle == IntPtr.Zero; diff --git a/src/csharp/Config.cs b/src/csharp/Config.cs index c263c9ea0..63fa81303 100644 --- a/src/csharp/Config.cs +++ b/src/csharp/Config.cs @@ -5,65 +5,29 @@ namespace Microsoft.ML.OnnxRuntimeGenAI { - /// - /// Use Config to set the ORT execution providers (EPs) and their options. The EPs are applied based on - /// insertion order. - /// public class Config : IDisposable { private IntPtr _configHandle; private bool _disposed = false; - - /// - /// Creates a Config from the given configuration directory. - /// - /// The path to the configuration directory. - /// - /// Thrown when the call to the GenAI native API fails. - /// public Config(string modelPath) { Result.VerifySuccess(NativeMethods.OgaCreateConfig(StringUtils.ToUtf8(modelPath), out _configHandle)); } internal IntPtr Handle { get { return _configHandle; } } - - /// - /// Clear the list of providers in the config. - /// - /// - /// Thrown when the call to the GenAI native API fails. - /// public void ClearProviders() { Result.VerifySuccess(NativeMethods.OgaConfigClearProviders(_configHandle)); } - /// - /// Add the provider at the end of the list of providers in the given config if it doesn't already - /// exist. If it already exists, does nothing. - /// - /// Name of the provider - /// - /// Thrown when the call to the GenAI native API fails. - /// - public void AppendProvider(string providerName) + public void AppendProvider(string provider) { - Result.VerifySuccess(NativeMethods.OgaConfigAppendProvider(_configHandle, StringUtils.ToUtf8(providerName))); + Result.VerifySuccess(NativeMethods.OgaConfigAppendProvider(_configHandle, StringUtils.ToUtf8(provider))); } - /// - /// Set a provider option. - /// - /// Name of the provider - /// Name of the option - /// Value of the option - /// - /// Thrown when the call to the GenAI native API fails. - /// - public void SetProviderOption(string providerName, string optionKey, string optionValue) + public void SetProviderOption(string provider, string option, string value) { - Result.VerifySuccess(NativeMethods.OgaConfigSetProviderOption(_configHandle, StringUtils.ToUtf8(providerName), StringUtils.ToUtf8(optionKey), StringUtils.ToUtf8(optionValue))); + Result.VerifySuccess(NativeMethods.OgaConfigSetProviderOption(_configHandle, StringUtils.ToUtf8(provider), StringUtils.ToUtf8(option), StringUtils.ToUtf8(value))); } ~Config() diff --git a/src/csharp/Exceptions.cs b/src/csharp/Exceptions.cs index 72fff400f..8228bf794 100644 --- a/src/csharp/Exceptions.cs +++ b/src/csharp/Exceptions.cs @@ -5,9 +5,6 @@ namespace Microsoft.ML.OnnxRuntimeGenAI { - /// - /// An exception which contains the error message and code produced by the native layer. - /// public class OnnxRuntimeGenAIException: Exception { internal OnnxRuntimeGenAIException(string message) @@ -15,4 +12,6 @@ internal OnnxRuntimeGenAIException(string message) { } } + + } diff --git a/src/csharp/Generator.cs b/src/csharp/Generator.cs index 97204c85b..80baba6f7 100644 --- a/src/csharp/Generator.cs +++ b/src/csharp/Generator.cs @@ -5,44 +5,21 @@ namespace Microsoft.ML.OnnxRuntimeGenAI { - /// - /// The Generator class generates output using a model and generator parameters. - /// public class Generator : IDisposable { private IntPtr _generatorHandle; private bool _disposed = false; - /// - /// Constructs a Generator object with the given model and generator parameters. - /// The model to use. - /// The generator parameters. - /// - /// Thrown when the call to the GenAI native API fails. - /// public Generator(Model model, GeneratorParams generatorParams) { Result.VerifySuccess(NativeMethods.OgaCreateGenerator(model.Handle, generatorParams.Handle, out _generatorHandle)); } - /// - /// Checks if the generation process is done. - /// - /// - /// True if the generation process is done, false otherwise. - /// public bool IsDone() { return NativeMethods.OgaGenerator_IsDone(_generatorHandle) != 0; } - /// - /// Appends tokens to the generator. - /// - /// The tokens to append. - /// - /// Thrown when the call to the GenAI native API fails. - /// public void AppendTokens(ReadOnlySpan inputIDs) { unsafe @@ -54,50 +31,26 @@ public void AppendTokens(ReadOnlySpan inputIDs) } } - /// - /// Appends token sequences to the generator. - /// - /// The sequences to append. - /// - /// Thrown when the call to the GenAI native API fails. - /// public void AppendTokenSequences(Sequences sequences) { Result.VerifySuccess(NativeMethods.OgaGenerator_AppendTokenSequences(_generatorHandle, sequences.Handle)); } - /// - /// Computes the logits from the model based on the input ids and the past state. The computed - /// logits are stored in the generator. - /// - /// - /// Thrown when the call to the GenAI native API fails. - /// public void GenerateNextToken() { Result.VerifySuccess(NativeMethods.OgaGenerator_GenerateNextToken(_generatorHandle)); } /// - /// Rewinds the generator to the given length. This is useful when the user wants to rewind the - /// generator to a specific length and continue generating from that point. + /// Rewinds the generator to the given newLength. + /// Throw on error /// - /// The desired length in tokens after rewinding. - /// - /// Thrown when the call to the GenAI native API fails. - /// + /// public void RewindTo(ulong newLength) { Result.VerifySuccess(NativeMethods.OgaGenerator_RewindTo(_generatorHandle, (UIntPtr)newLength)); } - /// - /// Retrieves a sequence of token ids for the specified sequence index. - /// - /// The index of the sequence. - /// - /// A ReadOnlySpan of integers with the sequence token ids. - /// public ReadOnlySpan GetSequence(ulong index) { ulong sequenceLength = NativeMethods.OgaGenerator_GetSequenceCount(_generatorHandle, (UIntPtr)index).ToUInt64(); @@ -109,29 +62,25 @@ public ReadOnlySpan GetSequence(ulong index) } /// - /// Returns a copy of the model output identified by the given name as a Tensor. + /// Fetches and returns the output tensor with the given name. + /// Throw on error /// - /// The name of the output needed. - /// A disposable instance of Tensor - /// - /// Thrown when the call to the GenAI native API fails. - /// - public Tensor GetOutput(string name) + /// + /// a disposable instance of Tensor + public Tensor GetOutput(string outputName) { Result.VerifySuccess(NativeMethods.OgaGenerator_GetOutput(_generatorHandle, - StringUtils.ToUtf8(name), + StringUtils.ToUtf8(outputName), out IntPtr outputTensor)); return new Tensor(outputTensor); } /// - /// Sets the adapter with the given adapter name as active. + /// Activates one of the loaded adapters. + /// Throws on error. /// - /// The adapters container. - /// The adapter name that was previously loaded. - /// - /// Thrown when the call to the GenAI native API fails. - /// + /// Adapters container + /// adapter name that was previously loaded public void SetActiveAdapter(Adapters adapters, string adapterName) { Result.VerifySuccess(NativeMethods.OgaSetActiveAdapter(_generatorHandle, diff --git a/src/csharp/GeneratorParams.cs b/src/csharp/GeneratorParams.cs index a170685da..53f384ef2 100644 --- a/src/csharp/GeneratorParams.cs +++ b/src/csharp/GeneratorParams.cs @@ -8,21 +8,10 @@ namespace Microsoft.ML.OnnxRuntimeGenAI { - /// - /// Represents the parameters used for generating sequences with a model. - /// public class GeneratorParams : IDisposable { private IntPtr _generatorParamsHandle; private bool _disposed = false; - - /// - /// Creates a GeneratorParams from the given model. - /// - /// The model to use. - /// - /// Thrown when the call to the GenAI native API fails. - /// public GeneratorParams(Model model) { Result.VerifySuccess(NativeMethods.OgaCreateGeneratorParams(model.Handle, out _generatorParamsHandle)); @@ -30,64 +19,26 @@ public GeneratorParams(Model model) internal IntPtr Handle { get { return _generatorParamsHandle; } } - /// - /// Set seach option with double value. - /// - /// The option name - /// The option value - /// - /// Thrown when the call to the GenAI native API fails. - /// public void SetSearchOption(string searchOption, double value) { Result.VerifySuccess(NativeMethods.OgaGeneratorParamsSetSearchNumber(_generatorParamsHandle, StringUtils.ToUtf8(searchOption), value)); } - /// - /// Set seach option with boolean value. - /// - /// The option name - /// The option value - /// - /// Thrown when the call to the GenAI native API fails. - /// public void SetSearchOption(string searchOption, bool value) { Result.VerifySuccess(NativeMethods.OgaGeneratorParamsSetSearchBool(_generatorParamsHandle, StringUtils.ToUtf8(searchOption), value)); } - /// - /// Try graph capture. - /// - /// The max batch size - /// - /// Thrown when the call to the GenAI native API fails. - /// public void TryGraphCaptureWithMaxBatchSize(int maxBatchSize) { Result.VerifySuccess(NativeMethods.OgaGeneratorParamsTryGraphCaptureWithMaxBatchSize(_generatorParamsHandle, maxBatchSize)); } - /// - /// Add a Tensor as a model input. - /// - /// The name of the model input the tensor will provide. - /// The tensor value. - /// - /// Thrown when the call to the GenAI native API fails. - /// public void SetModelInput(string name, Tensor value) { Result.VerifySuccess(NativeMethods.OgaGeneratorParamsSetModelInput(_generatorParamsHandle, StringUtils.ToUtf8(name), value.Handle)); } - /// - /// Add a NamedTensors as a model input. - /// - /// The NamedTensors value. - /// - /// Thrown when the call to the GenAI native API fails. - /// public void SetInputs(NamedTensors namedTensors) { Result.VerifySuccess(NativeMethods.OgaGeneratorParamsSetInputs(_generatorParamsHandle, namedTensors.Handle)); diff --git a/src/csharp/Images.cs b/src/csharp/Images.cs index e4e692686..b160f869e 100644 --- a/src/csharp/Images.cs +++ b/src/csharp/Images.cs @@ -6,9 +6,6 @@ namespace Microsoft.ML.OnnxRuntimeGenAI { - /// - /// This class can load images from the given path and prepare them for processing. - /// public class Images : IDisposable { private IntPtr _imagesHandle; @@ -21,7 +18,7 @@ private Images(IntPtr imagesHandle) internal IntPtr Handle { get { return _imagesHandle; } } - private static Images Load(string[] imagePaths) + public static Images Load(string[] imagePaths) { Result.VerifySuccess(NativeMethods.OgaCreateStringArray(out IntPtr stringArray)); foreach (string imagePath in imagePaths) diff --git a/src/csharp/Model.cs b/src/csharp/Model.cs index 1e027ffe3..63fd7f96e 100644 --- a/src/csharp/Model.cs +++ b/src/csharp/Model.cs @@ -6,31 +6,16 @@ namespace Microsoft.ML.OnnxRuntimeGenAI { - /// - /// An ORT GenAI model. - /// public class Model : IDisposable { private IntPtr _modelHandle; private bool _disposed = false; - /// - /// Construct a Model from the given path. - /// The path of the model. - /// - /// Thrown when the call to the GenAI native API fails. - /// public Model(string modelPath) { Result.VerifySuccess(NativeMethods.OgaCreateModel(StringUtils.ToUtf8(modelPath), out _modelHandle)); } - /// - /// Construct a Model from Config. - /// The config to use. - /// - /// Thrown when the call to the GenAI native API fails. - /// public Model(Config config) { Result.VerifySuccess(NativeMethods.OgaCreateModelFromConfig(config.Handle, out _modelHandle)); diff --git a/src/csharp/MultiModalProcessor.cs b/src/csharp/MultiModalProcessor.cs index 15286ef97..a9baecb82 100644 --- a/src/csharp/MultiModalProcessor.cs +++ b/src/csharp/MultiModalProcessor.cs @@ -5,22 +5,11 @@ namespace Microsoft.ML.OnnxRuntimeGenAI { - /// - /// The MultiModalProcessor class is responsible for converting text/images into a NamedTensors list - /// that can be fed into a Generator class instance. - /// public class MultiModalProcessor : IDisposable { private IntPtr _processorHandle; private bool _disposed = false; - /// - /// Construct a MultiModalProcessor for a given model. - /// - /// The model to use. - /// - /// Thrown when the call to the GenAI native API fails. - /// public MultiModalProcessor(Model model) { Result.VerifySuccess(NativeMethods.OgaCreateMultiModalProcessor(model.Handle, out _processorHandle)); @@ -28,17 +17,6 @@ public MultiModalProcessor(Model model) internal IntPtr Handle { get { return _processorHandle; } } - /// - /// Processes a string and image into a NamedTensor. - /// - /// The text to encode as token ids. - /// The image input. - /// - /// The NamedTensors object. - /// - /// - /// Thrown when the call to the GenAI native API fails. - /// public NamedTensors ProcessImages(string prompt, Images images) { IntPtr imagesHandle = images == null ? IntPtr.Zero : images.Handle; @@ -47,16 +25,6 @@ public NamedTensors ProcessImages(string prompt, Images images) return new NamedTensors(namedTensorsHandle); } - /// - /// Decodes a sequence of token ids into text. - /// - /// The token ids to decode to text. - /// - /// The text representation of the sequence. - /// - /// - /// Thrown when the call to the GenAI native API fails. - /// public string Decode(ReadOnlySpan sequence) { IntPtr outStr = IntPtr.Zero; @@ -77,16 +45,6 @@ public string Decode(ReadOnlySpan sequence) } } - /// - /// Creates a TokenizerStream object for streaming tokenization. This is used with Generator class - /// to provide each token as it is generated. - /// - /// - /// The new TokenizerStream instance. - /// - /// - /// Thrown when the call to the GenAI native API fails. - /// public TokenizerStream CreateStream() { IntPtr tokenizerStreamHandle = IntPtr.Zero; diff --git a/src/csharp/Result.cs b/src/csharp/Result.cs index b757472c7..b64e14c98 100644 --- a/src/csharp/Result.cs +++ b/src/csharp/Result.cs @@ -6,7 +6,7 @@ namespace Microsoft.ML.OnnxRuntimeGenAI { - internal class Result + class Result { private static string GetErrorMessage(IntPtr nativeResult) { diff --git a/src/csharp/Sequences.cs b/src/csharp/Sequences.cs index c7910fce4..efa4ccaf2 100644 --- a/src/csharp/Sequences.cs +++ b/src/csharp/Sequences.cs @@ -5,9 +5,6 @@ namespace Microsoft.ML.OnnxRuntimeGenAI { - /// - /// Represents a collection of encoded prompts/responses. - /// public class Sequences : IDisposable { private IntPtr _sequencesHandle; @@ -22,14 +19,8 @@ internal Sequences(IntPtr sequencesHandle) internal IntPtr Handle { get { return _sequencesHandle; } } - /// - /// Gets the number of sequences in the collection. This is equivalent to the batch size. - /// public ulong NumSequences { get { return _numSequences; } } - /// - /// The indexed accessor of individual sequence. - /// public ReadOnlySpan this[ulong sequenceIndex] { get diff --git a/src/csharp/Tensor.cs b/src/csharp/Tensor.cs index 019a60734..1f1c11d83 100644 --- a/src/csharp/Tensor.cs +++ b/src/csharp/Tensor.cs @@ -6,10 +6,7 @@ namespace Microsoft.ML.OnnxRuntimeGenAI { - /// - /// Element types that correspond to OnnxRuntime supported element types. - /// - /// The values in this enum must match ONNX Runtime's type values + // The values in this enum must match ONNX Runtime's type values public enum ElementType : long { undefined, @@ -28,23 +25,11 @@ public enum ElementType : long uint64, } - /// - /// Currently wraps an ORT Tensor. - /// public class Tensor : IDisposable { private IntPtr _tensorHandle; private bool _disposed = false; - /// - /// Constructs a Tensor with the given data pointer, shape and element type. - /// - /// The data pointer. - /// The shape of the Tensor. - /// The type of elements in the Tensor. - /// - /// Thrown when the call to the GenAI native API fails. - /// public Tensor(IntPtr data, Int64[] shape, ElementType type) { Result.VerifySuccess(NativeMethods.OgaCreateTensorFromBuffer(data, shape, (UIntPtr)shape.Length, type, out _tensorHandle)); @@ -63,31 +48,12 @@ internal Tensor(IntPtr tensorHandle) { Dispose(false); } - - /// - /// Get the element type. - /// - /// - /// The element type. - /// - /// - /// Thrown when the call to the GenAI native API fails. - /// public ElementType Type() { Result.VerifySuccess(NativeMethods.OgaTensorGetType(_tensorHandle, out ElementType element_type)); return element_type; } - /// - /// Get the tensor shape. - /// - /// - /// The shape. - /// - /// - /// Thrown when the call to the GenAI native API fails. - /// public Int64[] Shape() { Result.VerifySuccess(NativeMethods.OgaTensorGetShapeRank(_tensorHandle, out UIntPtr size)); @@ -115,7 +81,7 @@ public static Int64 ElementsFromShape(Int64[] shape) /// /// Computes and returns number of elements in the tensor /// - /// The number of elements. + /// public Int64 NumElements() { return ElementsFromShape(Shape()); @@ -127,9 +93,6 @@ public Int64 NumElements() /// /// /// read only span - /// - /// Thrown when the call to the GenAI native API fails. - /// public ReadOnlySpan GetData() { var elements = NumElements(); @@ -157,9 +120,6 @@ protected virtual void Dispose(bool disposing) } } - /// - /// This class is a list of tensors with names that match up with model input names. - /// public class NamedTensors : IDisposable { private IntPtr _namedTensorsHandle; diff --git a/src/csharp/Tokenizer.cs b/src/csharp/Tokenizer.cs index 9bc7d25a7..1d99566ab 100644 --- a/src/csharp/Tokenizer.cs +++ b/src/csharp/Tokenizer.cs @@ -5,36 +5,16 @@ namespace Microsoft.ML.OnnxRuntimeGenAI { - /// - /// The Tokenizer class is responsible for converting between text and token ids. - /// public class Tokenizer : IDisposable { private IntPtr _tokenizerHandle; private bool _disposed = false; - /// - /// Creates a Tokenizer from the given model. - /// - /// The model to use. - /// - /// Thrown when the call to the GenAI native API fails. - /// public Tokenizer(Model model) { Result.VerifySuccess(NativeMethods.OgaCreateTokenizer(model.Handle, out _tokenizerHandle)); } - /// - /// Encodes an array of strings into a sequence of token ids for each input. - /// - /// The collection of strings to encode as token ids. - /// - /// A Sequences object with one sequence per input string. - /// - /// - /// Thrown when the call to the GenAI native API fails. - /// public Sequences EncodeBatch(string[] strings) { Result.VerifySuccess(NativeMethods.OgaCreateSequences(out IntPtr nativeSequences)); @@ -54,16 +34,6 @@ public Sequences EncodeBatch(string[] strings) } } - /// - /// Decodes a batch of sequences of token ids into text. - /// - /// A Sequences object with one or more sequences of token ids. - /// - /// An array of strings with the text representation of each sequence. - /// - /// - /// Thrown when the call to the GenAI native API fails. - /// public string[] DecodeBatch(Sequences sequences) { string[] result = new string[sequences.NumSequences]; @@ -75,16 +45,6 @@ public string[] DecodeBatch(Sequences sequences) return result; } - /// - /// Encodes an array of strings into a sequence of token ids for each input. - /// - /// The text to encode as token ids. - /// - /// A Sequences object with a single sequence. - /// - /// - /// Thrown when the call to the GenAI native API fails. - /// public Sequences Encode(string str) { Result.VerifySuccess(NativeMethods.OgaCreateSequences(out IntPtr nativeSequences)); @@ -100,16 +60,6 @@ public Sequences Encode(string str) } } - /// - /// Decodes a sequence of token ids into text. - /// - /// The token ids. - /// - /// The text representation of the sequence. - /// - /// - /// Thrown when the call to the GenAI native API fails. - /// public string Decode(ReadOnlySpan sequence) { IntPtr outStr = IntPtr.Zero; @@ -130,16 +80,6 @@ public string Decode(ReadOnlySpan sequence) } } - /// - /// Creates a TokenizerStream object for streaming tokenization. This is used with Generator class - /// to provide each token as it is generated. - /// - /// - /// The new TokenizerStream instance. - /// - /// - /// Thrown when the call to the GenAI native API fails. - /// public TokenizerStream CreateStream() { IntPtr tokenizerStreamHandle = IntPtr.Zero; diff --git a/src/csharp/TokenizerStream.cs b/src/csharp/TokenizerStream.cs index 490755434..07140d382 100644 --- a/src/csharp/TokenizerStream.cs +++ b/src/csharp/TokenizerStream.cs @@ -5,9 +5,6 @@ namespace Microsoft.ML.OnnxRuntimeGenAI { - /// - /// A TokenizerStream is used to convert individual tokens when using Generator.GenerateNextToken. - /// public class TokenizerStream : IDisposable { private IntPtr _tokenizerStreamHandle; @@ -20,16 +17,6 @@ internal TokenizerStream(IntPtr tokenizerStreamHandle) internal IntPtr Handle { get { return _tokenizerStreamHandle; } } - /// - /// Decode one token. - /// - /// The token. - /// - /// The decoded result. - /// - /// - /// Thrown when the call to the GenAI native API fails. - /// public string Decode(int token) { IntPtr decodedStr = IntPtr.Zero; diff --git a/src/csharp/Utils.cs b/src/csharp/Utils.cs index cb206f24e..eb65b924a 100644 --- a/src/csharp/Utils.cs +++ b/src/csharp/Utils.cs @@ -6,9 +6,6 @@ namespace Microsoft.ML.OnnxRuntimeGenAI { - /// - /// A utility class that helps free native resources easily. - /// public class OgaHandle: IDisposable { private bool _disposed = false; @@ -39,10 +36,7 @@ protected virtual void Dispose(bool disposing) } } - /// - /// Wraps some utility functions that are available globally - /// - internal class Utils + public class Utils { public static void SetCurrentGpuDeviceId(int device_id) { @@ -60,7 +54,7 @@ public static void SetLogBool(string name, bool value) { Result.VerifySuccess(NativeMethods.OgaSetLogBool(StringUtils.ToUtf8(name), value)); } - + public static void SetLogString(string name, string value) { Result.VerifySuccess(NativeMethods.OgaSetLogString(StringUtils.ToUtf8(name), StringUtils.ToUtf8(value)));