Namespace: LLama
Assorted llama utilities
public static class Utils
Use LLamaWeights.LoadFromFile and LLamaWeights.CreateContext instead
public static SafeLLamaContextHandle InitLLamaContextFromModelParams(IModelParams params)
params IModelParams
Use SafeLLamaContextHandle Tokenize method instead
public static IEnumerable<int> Tokenize(SafeLLamaContextHandle ctx, string text, bool add_bos, Encoding encoding)
text String
add_bos Boolean
encoding Encoding
Use SafeLLamaContextHandle GetLogits method instead
public static Span<float> GetLogits(SafeLLamaContextHandle ctx, int length)
length Int32
Use SafeLLamaContextHandle Eval method instead
public static int Eval(SafeLLamaContextHandle ctx, Int32[] tokens, int startIndex, int n_tokens, int n_past, int n_threads)
tokens Int32[]
startIndex Int32
n_tokens Int32
n_past Int32
n_threads Int32
Use SafeLLamaContextHandle TokenToString method instead
public static string TokenToString(int token, SafeLLamaContextHandle ctx, Encoding encoding)
token Int32
encoding Encoding
No longer used internally by LlamaSharp
public static string PtrToString(IntPtr ptr, Encoding encoding)
ptr IntPtr
encoding Encoding