@@ -137,6 +137,14 @@ private static Sampler createSampler(Model model, Options options) {
137
137
return selectSampler (model .configuration ().vocabularySize (), options .temperature (), options .topp (), options .seed ());
138
138
}
139
139
140
+ private static void runSingleInstruction (Model model , Sampler sampler , Options options ) {
141
+ String response = model .runInstructOnce (sampler , options );
142
+ System .out .println (response );
143
+ if (SHOW_PERF_INTERACTIVE ) {
144
+ LastRunMetrics .printMetrics ();
145
+ }
146
+ }
147
+
140
148
/**
141
149
* Entry point for running the LLaMA-based model with provided command-line arguments.
142
150
*
@@ -148,19 +156,15 @@ private static Sampler createSampler(Model model, Options options) {
148
156
* @throws IOException
149
157
* if model loading or file operations fail.
150
158
*/
151
- public static void main (String [] args ) throws IOException {
159
+ static void main (String [] args ) throws IOException {
152
160
Options options = Options .parseOptions (args );
153
161
Model model = loadModel (options );
154
162
Sampler sampler = createSampler (model , options );
155
163
156
164
if (options .interactive ()) {
157
165
model .runInteractive (sampler , options );
158
166
} else {
159
- String response = model .runInstructOnce (sampler , options );
160
- System .out .println (response );
161
- if (SHOW_PERF_INTERACTIVE ) {
162
- LastRunMetrics .printMetrics ();
163
- }
167
+ runSingleInstruction (model , sampler , options );
164
168
}
165
169
}
166
170
}
0 commit comments