diff options
3 files changed, 57 insertions, 5 deletions
diff --git a/model-integration/src/main/java/ai/vespa/modelintegration/evaluator/OnnxEvaluator.java b/model-integration/src/main/java/ai/vespa/modelintegration/evaluator/OnnxEvaluator.java index 628fe933bf5..cd698eb1647 100644 --- a/model-integration/src/main/java/ai/vespa/modelintegration/evaluator/OnnxEvaluator.java +++ b/model-integration/src/main/java/ai/vespa/modelintegration/evaluator/OnnxEvaluator.java @@ -151,8 +151,8 @@ public class OnnxEvaluator implements AutoCloseable { throw new IllegalArgumentException("No such file: " + model.path().get()); } if (tryCuda && isCudaError(e) && !options.gpuDeviceRequired()) { - LOG.log(Level.WARNING, "Failed to create session with CUDA using GPU device " + - options.gpuDeviceNumber() + ". Falling back to CPU", e); + LOG.log(Level.INFO, "Failed to create session with CUDA using GPU device " + + options.gpuDeviceNumber() + ". Falling back to CPU. Reason: " + e.getMessage()); return createSession(model, runtime, options, false); } if (isCudaError(e)) { diff --git a/model-integration/src/test/java/ai/vespa/modelintegration/evaluator/OnnxEvaluatorTest.java b/model-integration/src/test/java/ai/vespa/modelintegration/evaluator/OnnxEvaluatorTest.java index db2e9db1277..9bb01fc8073 100644 --- a/model-integration/src/test/java/ai/vespa/modelintegration/evaluator/OnnxEvaluatorTest.java +++ b/model-integration/src/test/java/ai/vespa/modelintegration/evaluator/OnnxEvaluatorTest.java @@ -9,9 +9,16 @@ import org.junit.Test; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.logging.Handler; +import java.util.logging.LogRecord; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assume.assumeTrue; @@ -170,6 +177,29 @@ public class OnnxEvaluatorTest { evaluator.close(); } + @Test + public void testLoggingMessages() throws IOException { + assumeTrue(OnnxRuntime.isRuntimeAvailable()); + Logger logger = Logger.getLogger(OnnxEvaluator.class.getName()); + CustomLogHandler logHandler = new CustomLogHandler(); + logger.addHandler(logHandler); + var runtime = new OnnxRuntime(); + var model = Files.readAllBytes(Paths.get("src/test/models/onnx/simple/simple.onnx")); + OnnxEvaluatorOptions options = new OnnxEvaluatorOptions(); + options.setGpuDevice(0); + var evaluator = runtime.evaluatorOf(model,options); + evaluator.close(); + List<LogRecord> records = logHandler.getLogRecords(); + assertEquals(1,records.size()); + assertEquals(Level.INFO,records.get(0).getLevel()); + String message = records.get(0).getMessage(); + assertEquals("Failed to create session with CUDA using GPU device 0. " + + "Falling back to CPU. Reason: Error code - ORT_EP_FAIL - message:" + + " Failed to find CUDA shared provider", message); + logger.removeHandler(logHandler); + + } + private void assertEvaluate(OnnxRuntime runtime, String model, String output, String... input) { OnnxEvaluator evaluator = runtime.evaluatorOf("src/test/models/onnx/" + model); Map<String, Tensor> inputs = new HashMap<>(); @@ -182,4 +212,25 @@ public class OnnxEvaluatorTest { assertEquals(expected.type().valueType(), result.type().valueType()); } + static class CustomLogHandler extends Handler { + private List<LogRecord> records = new ArrayList<>(); + + @Override + public void publish(LogRecord record) { + records.add(record); + } + + @Override + public void flush() { + } + + @Override + public void close() throws SecurityException { + } + + public List<LogRecord> getLogRecords() { + return records; + } + } + } diff --git a/screwdriver.yaml b/screwdriver.yaml index 5b9c39574a1..ccab9bc4bd0 100644 --- a/screwdriver.yaml +++ b/screwdriver.yaml @@ -368,7 +368,7 @@ jobs: environment: BASE_IMAGE: "el9" - IMAGE_NAME: "vespaengine/vespa-el9-preview" + IMAGE_NAME: "vespa-el9-preview" secrets: - DOCKER_HUB_DEPLOY_KEY @@ -403,7 +403,8 @@ jobs: --build-arg VESPA_BASE_IMAGE=$BASE_IMAGE \ --build-arg VESPA_VERSION=$VESPA_VERSION \ --file Dockerfile \ - --tag docker.io/vespaengine/$IMAGE_NAME:latest \ + --tag vespaengine/vespa:latest \ + --tag vespaengine/$IMAGE_NAME:latest \ . - verify-container-image: | # Run quick start guide @@ -444,7 +445,7 @@ jobs: screwdriver.cd/buildPeriodically: H 6 1 * * environment: BASE_IMAGE: "el8" - IMAGE_NAME: "vespaengine/vespa-el8-preview" + IMAGE_NAME: "vespa-el8-preview" secrets: - DOCKER_HUB_DEPLOY_KEY steps: *publish-el9-preview-steps |