Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge contributor #93

Closed
wants to merge 12 commits into from
Prev Previous commit
Next Next commit
feat(ios): expose DRY sampler params
  • Loading branch information
jhen0409 committed Nov 18, 2024
commit 0c4675d26bc4907fa6fea4762a95bed8da84200c
13 changes: 13 additions & 0 deletions ios/RNLlamaContext.mm
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,19 @@ - (NSDictionary *)completion:(NSDictionary *)params
if (params[@"xtc_probability"]) sparams.xtc_probability = [params[@"xtc_probability"] doubleValue];
if (params[@"typical_p"]) sparams.typ_p = [params[@"typical_p"] doubleValue];

if (params[@"dry_multiplier"]) sparams.dry_multiplier = [params[@"dry_multiplier"] doubleValue];
if (params[@"dry_base"]) sparams.dry_base = [params[@"dry_base"] doubleValue];
if (params[@"dry_allowed_length"]) sparams.dry_allowed_length = [params[@"dry_allowed_length"] intValue];
if (params[@"dry_penalty_last_n"]) sparams.dry_penalty_last_n = [params[@"dry_penalty_last_n"] intValue];

// dry break seq
if (params[@"dry_sequence_breakers"] && [params[@"dry_sequence_breakers"] isKindOfClass:[NSArray class]]) {
NSArray *dry_sequence_breakers = params[@"dry_sequence_breakers"];
for (NSString *s in dry_sequence_breakers) {
sparams.dry_sequence_breakers.push_back([s UTF8String]);
}
}

if (params[@"grammar"]) {
sparams.grammar = [params[@"grammar"] UTF8String];
}
Expand Down
Loading