Skip to content

Commit 881a0ee

Browse files
committed
CUDA mode is pretty fast.
1 parent fa6a407 commit 881a0ee

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

ihmc-high-level-behaviors/build.gradle.kts

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ mainDependencies {
1818
exclude(group = "org.lwjgl.lwjgl") // exclude lwjgl 2
1919
}
2020
api("us.ihmc:promp-java:1.0.1")
21-
api("de.kherud:llama:3.4.1")
22-
// api("de.kherud:llama:3.4.1:cuda12-linux-x86-64")
21+
// api("de.kherud:llama:3.4.1") // CPU mode
22+
api("de.kherud:llama:3.4.1:cuda12-linux-x86-64")
2323
}
2424

2525
libgdxDependencies {

ihmc-high-level-behaviors/src/main/java/us/ihmc/behaviors/reasoning/BehaviorTreeNextActionReasoning.java

+13-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import de.kherud.llama.LlamaModel;
55
import de.kherud.llama.ModelParameters;
66
import de.kherud.llama.args.MiroStat;
7+
import us.ihmc.commons.time.Stopwatch;
78
import us.ihmc.log.LogTools;
89
import us.ihmc.tools.IHMCCommonPaths;
910

@@ -122,9 +123,11 @@ public int queryNextLeafToExecuteIndex()
122123

123124
String reponse = model.complete(inferParams);
124125

125-
LogTools.info(prompt + reponse);
126+
// LogTools.info(prompt + reponse);
127+
//
128+
// LogTools.info("Response: {}", reponse);
126129

127-
return 0;
130+
return Integer.parseInt(reponse.trim());
128131
}
129132

130133
public void destroy()
@@ -135,7 +138,14 @@ public void destroy()
135138
public static void main(String[] args)
136139
{
137140
BehaviorTreeNextActionReasoning reasoning = new BehaviorTreeNextActionReasoning();
138-
reasoning.queryNextLeafToExecuteIndex();
141+
142+
for (int i = 0; i < 10; i++)
143+
{
144+
Stopwatch stopwatch = new Stopwatch().start();
145+
int leafIndex = reasoning.queryNextLeafToExecuteIndex();
146+
LogTools.info("Returned {} in {} seconds", leafIndex, stopwatch.totalElapsed());
147+
}
148+
139149
reasoning.destroy();
140150

141151
System.exit(0); // FIXME: Not sure why it's not exiting automatically.

0 commit comments

Comments
 (0)