chore(llm-tool): add the top_p option in the llm-tool (#41)
* chore: add top p option in llm-tool * chore: wire up the top p with async generate
This commit is contained in:
@@ -29,6 +29,9 @@ struct LLMArguments: ParsableArguments {
|
||||
@Option(name: .shortAndLong, help: "The sampling temperature")
|
||||
var temperature: Float = 0.6
|
||||
|
||||
@Option(name: .shortAndLong, help: "The top p sampling")
|
||||
var topP: Float = 0.9
|
||||
|
||||
@Option(name: .long, help: "The PRNG seed")
|
||||
var seed: UInt64 = 0
|
||||
|
||||
@@ -127,7 +130,7 @@ struct SyncGenerator: AsyncParsableCommand {
|
||||
var printed = 0
|
||||
|
||||
for token in TokenIterator(
|
||||
prompt: MLXArray(promptTokens), model: model, temp: args.temperature)
|
||||
prompt: MLXArray(promptTokens), model: model, temp: args.temperature, topP: args.topP)
|
||||
{
|
||||
if tokens.isEmpty {
|
||||
eval(token)
|
||||
@@ -205,7 +208,7 @@ struct AsyncGenerator: AsyncParsableCommand {
|
||||
var printed = 0
|
||||
|
||||
let (task, channel) = generate(
|
||||
prompt: MLXArray(promptTokens), model: model, temp: args.temperature)
|
||||
prompt: MLXArray(promptTokens), model: model, temp: args.temperature, topP: args.topP)
|
||||
|
||||
for await token in channel {
|
||||
if tokens.isEmpty {
|
||||
|
||||
Reference in New Issue
Block a user