Skip to content

Commit 39b3b9d

Browse files
committed
Add --use-tornadovm CLI flag and update TornadoVM default to true for better configurability.
1 parent 002ac5a commit 39b3b9d

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/main/java/org/beehive/gpullama3/Options.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import java.nio.file.Path;
55
import java.nio.file.Paths;
66

7-
public record Options(Path modelPath, String prompt, String systemPrompt, String suffix, boolean interactive,
8-
float temperature, float topp, long seed, int maxTokens, boolean stream, boolean echo, boolean useTornadovm) {
7+
public record Options(Path modelPath, String prompt, String systemPrompt, String suffix, boolean interactive, float temperature, float topp, long seed, int maxTokens, boolean stream, boolean echo,
8+
boolean useTornadovm) {
99

1010
public static final int DEFAULT_MAX_TOKENS = 1024;
1111

@@ -25,10 +25,9 @@ static void require(boolean condition, String messageFormat, Object... args) {
2525
}
2626

2727
private static boolean getDefaultTornadoVM() {
28-
return Boolean.parseBoolean(System.getProperty("use.tornadovm", "false"));
28+
return Boolean.parseBoolean(System.getProperty("use.tornadovm", "true"));
2929
}
3030

31-
3231
static void printUsage(PrintStream out) {
3332
out.println("Usage: jbang Llama3.java [options]");
3433
out.println();
@@ -48,7 +47,6 @@ static void printUsage(PrintStream out) {
4847
out.println();
4948
}
5049

51-
5250
public static Options getDefaultOptions() {
5351
String prompt = "Tell me a story with Java"; // Hardcoded for testing
5452
String systemPrompt = null;
@@ -57,7 +55,6 @@ public static Options getDefaultOptions() {
5755
float topp = 0.95f;
5856
Path modelPath = null;
5957
long seed = System.nanoTime();
60-
// Keep max context length small for low-memory devices.
6158
int maxTokens = DEFAULT_MAX_TOKENS;
6259
boolean interactive = false;
6360
boolean stream = true;
@@ -75,7 +72,6 @@ public static Options parseOptions(String[] args) {
7572
float topp = 0.95f;
7673
Path modelPath = null;
7774
long seed = System.nanoTime();
78-
// Keep max context length small for low-memory devices.
7975
int maxTokens = DEFAULT_MAX_TOKENS;
8076
boolean interactive = false;
8177
boolean stream = false;
@@ -114,6 +110,7 @@ public static Options parseOptions(String[] args) {
114110
case "--max-tokens", "-n" -> maxTokens = Integer.parseInt(nextArg);
115111
case "--stream" -> stream = Boolean.parseBoolean(nextArg);
116112
case "--echo" -> echo = Boolean.parseBoolean(nextArg);
113+
case "--use-tornadovm" -> useTornadovm = Boolean.parseBoolean(nextArg);
117114
default -> require(false, "Unknown option: %s", optionName);
118115
}
119116
}

0 commit comments

Comments
 (0)