Skip to content

Commit ab25486

Browse files
authored
Fix ollama example (#11217)
1 parent 73726f4 commit ab25486

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

examples/ollama-hugging-face/src/test/java/com/example/ollamahf/OllamaHuggingFaceContainer.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,7 @@ protected void containerIsStarted(InspectContainerResponse containerInfo, boolea
2828
executeCommand("apt-get", "upgrade", "-y");
2929
executeCommand("apt-get", "install", "-y", "python3-pip");
3030
executeCommand("pip", "install", "huggingface-hub");
31-
executeCommand(
32-
"huggingface-cli",
33-
"download",
34-
huggingFaceModel.repository,
35-
huggingFaceModel.model,
36-
"--local-dir",
37-
"."
38-
);
31+
executeCommand("hf", "download", huggingFaceModel.repository, huggingFaceModel.model, "--local-dir", ".");
3932
executeCommand("sh", "-c", String.format("echo '%s' > Modelfile", huggingFaceModel.modelfileContent));
4033
executeCommand("ollama", "create", huggingFaceModel.model, "-f", "Modelfile");
4134
executeCommand("rm", huggingFaceModel.model);
@@ -48,7 +41,7 @@ private void executeCommand(String... command) throws ContainerLaunchException,
4841
ExecResult execResult = execInContainer(command);
4942
if (execResult.getExitCode() > 0) {
5043
throw new ContainerLaunchException(
51-
"Failed to execute " + String.join(" ", command) + ": " + execResult.getStderr()
44+
"Failed to execute " + String.join(" ", command) + ": " + execResult.getStdout()
5245
);
5346
}
5447
}

0 commit comments

Comments
 (0)