4
4
import java .nio .file .Path ;
5
5
import java .nio .file .Paths ;
6
6
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 ) {
9
9
10
10
public static final int DEFAULT_MAX_TOKENS = 1024 ;
11
11
@@ -25,10 +25,9 @@ static void require(boolean condition, String messageFormat, Object... args) {
25
25
}
26
26
27
27
private static boolean getDefaultTornadoVM () {
28
- return Boolean .parseBoolean (System .getProperty ("use.tornadovm" , "false " ));
28
+ return Boolean .parseBoolean (System .getProperty ("use.tornadovm" , "true " ));
29
29
}
30
30
31
-
32
31
static void printUsage (PrintStream out ) {
33
32
out .println ("Usage: jbang Llama3.java [options]" );
34
33
out .println ();
@@ -48,7 +47,6 @@ static void printUsage(PrintStream out) {
48
47
out .println ();
49
48
}
50
49
51
-
52
50
public static Options getDefaultOptions () {
53
51
String prompt = "Tell me a story with Java" ; // Hardcoded for testing
54
52
String systemPrompt = null ;
@@ -57,7 +55,6 @@ public static Options getDefaultOptions() {
57
55
float topp = 0.95f ;
58
56
Path modelPath = null ;
59
57
long seed = System .nanoTime ();
60
- // Keep max context length small for low-memory devices.
61
58
int maxTokens = DEFAULT_MAX_TOKENS ;
62
59
boolean interactive = false ;
63
60
boolean stream = true ;
@@ -75,7 +72,6 @@ public static Options parseOptions(String[] args) {
75
72
float topp = 0.95f ;
76
73
Path modelPath = null ;
77
74
long seed = System .nanoTime ();
78
- // Keep max context length small for low-memory devices.
79
75
int maxTokens = DEFAULT_MAX_TOKENS ;
80
76
boolean interactive = false ;
81
77
boolean stream = false ;
@@ -114,6 +110,7 @@ public static Options parseOptions(String[] args) {
114
110
case "--max-tokens" , "-n" -> maxTokens = Integer .parseInt (nextArg );
115
111
case "--stream" -> stream = Boolean .parseBoolean (nextArg );
116
112
case "--echo" -> echo = Boolean .parseBoolean (nextArg );
113
+ case "--use-tornadovm" -> useTornadovm = Boolean .parseBoolean (nextArg );
117
114
default -> require (false , "Unknown option: %s" , optionName );
118
115
}
119
116
}
0 commit comments