Skip to content

Commit

Permalink
fix: use -1 instead of LLAMA_DEFAULT_SEED for default seed
Browse files Browse the repository at this point in the history
  • Loading branch information
jhen0409 committed Jan 19, 2024
1 parent 6ab049e commit b55b97b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions android/src/main/java/com/rnllama/LlamaContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

public class LlamaContext {
public static final String NAME = "RNLlamaContext";
private static final int LLAMA_DEFAULT_SEED = 0xFFFFFFFF;

private int id;
private ReactApplicationContext reactContext;
Expand Down Expand Up @@ -175,7 +174,7 @@ public WritableMap completion(ReadableMap params) {
// float typical_p,
params.hasKey("typical_p") ? (float) params.getDouble("typical_p") : 1.00f,
// int seed,
params.hasKey("seed") ? params.getInt("seed") : LLAMA_DEFAULT_SEED,
params.hasKey("seed") ? params.getInt("seed") : -1,
// String[] stop,
params.hasKey("stop") ? params.getArray("stop").toArrayList().toArray(new String[0]) : new String[0],
// boolean ignore_eos,
Expand Down
2 changes: 1 addition & 1 deletion ios/RNLlamaContext.mm
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ - (NSDictionary *)completion:(NSDictionary *)params

if (params[@"typical_p"]) sparams.typical_p = [params[@"typical_p"] doubleValue];

llama_set_rng_seed(llama->ctx, params[@"seed"] ? [params[@"seed"] intValue] : LLAMA_DEFAULT_SEED);
llama_set_rng_seed(llama->ctx, params[@"seed"] ? [params[@"seed"] intValue] : -1);

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

0 comments on commit b55b97b

Please sign in to comment.