Skip to content

LLamaModelV1

Namespace: LLama

Caution

This type is obsolete.


public class LLamaModelV1

Inheritance ObjectLLamaModelV1

Constructors

LLamaModelV1(String, Int32, Int32, Int32, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean, Int32, Int32, Int32, String, String, Boolean)

public LLamaModelV1(string model_path, int n_ctx, int n_parts, int seed, bool f16_kv, bool logits_all, bool vocab_only, bool use_mmap, bool use_mlock, bool embedding, int n_threads, int n_batch, int last_n_tokens_size, string lora_base, string lora_path, bool verbose)

Parameters

model_path String

n_ctx Int32

n_parts Int32

seed Int32

f16_kv Boolean

logits_all Boolean

vocab_only Boolean

use_mmap Boolean

use_mlock Boolean

embedding Boolean

n_threads Int32

n_batch Int32

last_n_tokens_size Int32

lora_base String

lora_path String

verbose Boolean

LLamaModelV1(LLamaModelV1)

public LLamaModelV1(LLamaModelV1 other)

Parameters

other LLamaModelV1

Methods

Tokenize(String)

public List<int> Tokenize(string text)

Parameters

text String

Returns

List<Int32>

DeTokenize(IEnumerable<Int32>)

public string DeTokenize(IEnumerable<int> tokens)

Parameters

tokens IEnumerable<Int32>

Returns

String

DeTokenize(Int32)

public string DeTokenize(int token)

Parameters

token Int32

Returns

String

SetCache(LLamaCache)

public void SetCache(LLamaCache cache)

Parameters

cache LLamaCache

Reset()

public void Reset()

Eval(List<Int32>)

public void Eval(List<int> tokens)

Parameters

tokens List<Int32>

Sample(Int32, Single, Single, Single, Single, Single)

public int Sample(int top_k, float top_p, float temp, float repeat_penalty, float frequency_penalty, float presence_penalty)

Parameters

top_k Int32

top_p Single

temp Single

repeat_penalty Single

frequency_penalty Single

presence_penalty Single

Returns

Int32

Generate(IEnumerable<Int32>, Int32, Single, Single, Single, Single, Single, Boolean)

public IEnumerable<int> Generate(IEnumerable<int> tokens, int top_k, float top_p, float temp, float repeat_penalty, float frequency_penalty, float presence_penalty, bool reset)

Parameters

tokens IEnumerable<Int32>

top_k Int32

top_p Single

temp Single

repeat_penalty Single

frequency_penalty Single

presence_penalty Single

reset Boolean

Returns

IEnumerable<Int32>

CreateEmbedding(String)

public Embedding CreateEmbedding(string input)

Parameters

input String

Returns

Embedding

Embed(String)

public Single[] Embed(string input)

Parameters

input String

Returns

Single[]

CreateCompletion(String, String, Int32, Single, Single, Int32, Boolean, String[], Single, Single, Single, Int32)

public IEnumerable<CompletionChunk> CreateCompletion(string prompt, string suffix, int max_tokens, float temperature, float top_p, int logprobs, bool echo, String[] stop, float frequency_penalty, float presence_penalty, float repeat_penalty, int top_k)

Parameters

prompt String

suffix String

max_tokens Int32

temperature Single

top_p Single

logprobs Int32

echo Boolean

stop String[]

frequency_penalty Single

presence_penalty Single

repeat_penalty Single

top_k Int32

Returns

IEnumerable<CompletionChunk>

Call(String, String, Int32, Single, Single, Int32, Boolean, String[], Single, Single, Single, Int32)

public IEnumerable<CompletionChunk> Call(string prompt, string suffix, int max_tokens, float temperature, float top_p, int logprobs, bool echo, String[] stop, float frequency_penalty, float presence_penalty, float repeat_penalty, int top_k)

Parameters

prompt String

suffix String

max_tokens Int32

temperature Single

top_p Single

logprobs Int32

echo Boolean

stop String[]

frequency_penalty Single

presence_penalty Single

repeat_penalty Single

top_k Int32

Returns

IEnumerable<CompletionChunk>

CreateChatCompletion(IEnumerable<ChatCompletionMessage>, Single, Single, Int32, String[], Int32, Single, Single, Single)

public IEnumerable<ChatCompletionChunk> CreateChatCompletion(IEnumerable<ChatCompletionMessage> messages, float temperature, float top_p, int top_k, String[] stop, int max_tokens, float presence_penalty, float frequency_penalty, float repeat_penalty)

Parameters

messages IEnumerable<ChatCompletionMessage>

temperature Single

top_p Single

top_k Int32

stop String[]

max_tokens Int32

presence_penalty Single

frequency_penalty Single

repeat_penalty Single

Returns

IEnumerable<ChatCompletionChunk>

SaveState()

public LLamaState SaveState()

Returns

LLamaState

LoadState(LLamaState)

public void LoadState(LLamaState state)

Parameters

state LLamaState

LongestTokenPrefix(IEnumerable<Int32>, IEnumerable<Int32>)

internal static int LongestTokenPrefix(IEnumerable<int> a, IEnumerable<int> b)

Parameters

a IEnumerable<Int32>

b IEnumerable<Int32>

Returns

Int32

<CreateChatCompletion>g__GetRole|31_0(ChatCompletionMessage)

internal static string <CreateChatCompletion>g__GetRole|31_0(ChatCompletionMessage message)

Parameters

message ChatCompletionMessage

Returns

String