From b476e7372025c78b9e45467ca2289aa89e33f502 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Mon, 4 Nov 2024 17:30:06 +0200 Subject: [PATCH] Add model name to progress log --- .../devservice/DevServicesOllamaProcessor.java | 2 +- .../jlama/deployment/JlamaProcessor.java | 2 +- .../llama3/deployment/Llama3Processor.java | 14 ++++++++------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/core/deployment/src/main/java/io/quarkiverse/langchain4j/deployment/devservice/DevServicesOllamaProcessor.java b/core/deployment/src/main/java/io/quarkiverse/langchain4j/deployment/devservice/DevServicesOllamaProcessor.java index b8198c1ca..b3a96af73 100644 --- a/core/deployment/src/main/java/io/quarkiverse/langchain4j/deployment/devservice/DevServicesOllamaProcessor.java +++ b/core/deployment/src/main/java/io/quarkiverse/langchain4j/deployment/devservice/DevServicesOllamaProcessor.java @@ -122,7 +122,7 @@ public void onNext(OllamaClient.PullAsyncLine line) { // avoid showing 100% for too long LOGGER.infof("Verifying and cleaning up\n", progress); } else { - LOGGER.infof("Progress: %s%%\n", progress); + LOGGER.infof("%s - Progress: %s%%\n", model, progress); } } } diff --git a/model-providers/jlama/deployment/src/main/java/io/quarkiverse/langchain4j/jlama/deployment/JlamaProcessor.java b/model-providers/jlama/deployment/src/main/java/io/quarkiverse/langchain4j/jlama/deployment/JlamaProcessor.java index c912bb531..fbf8edc0f 100644 --- a/model-providers/jlama/deployment/src/main/java/io/quarkiverse/langchain4j/jlama/deployment/JlamaProcessor.java +++ b/model-providers/jlama/deployment/src/main/java/io/quarkiverse/langchain4j/jlama/deployment/JlamaProcessor.java @@ -216,7 +216,7 @@ public void update(String filename, long sizeDownloaded, long totalSize) { // avoid showing 100% for too long LOGGER.infof("Verifying and cleaning up\n", progress); } else { - LOGGER.infof("Progress: %s%%\n", progress); + LOGGER.infof("%s - Progress: %s%%\n", modelName, progress); } } diff --git a/model-providers/llama3-java/deployment/src/main/java/io/quarkiverse/langchain4j/llama3/deployment/Llama3Processor.java b/model-providers/llama3-java/deployment/src/main/java/io/quarkiverse/langchain4j/llama3/deployment/Llama3Processor.java index 80f97ae66..1a905a9b7 100644 --- a/model-providers/llama3-java/deployment/src/main/java/io/quarkiverse/langchain4j/llama3/deployment/Llama3Processor.java +++ b/model-providers/llama3-java/deployment/src/main/java/io/quarkiverse/langchain4j/llama3/deployment/Llama3Processor.java @@ -12,11 +12,11 @@ import java.util.ArrayList; import java.util.List; import java.util.Optional; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicReference; import jakarta.enterprise.context.ApplicationScoped; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicReference; import org.apache.commons.io.file.PathUtils; import org.jboss.jandex.AnnotationInstance; import org.jboss.logging.Logger; @@ -201,23 +201,25 @@ public void update(String filename, long sizeDownloaded, long totalSize) { // avoid showing 100% for too long LOGGER.infof("Verifying and cleaning up\n", progress); } else { - LOGGER.infof("Progress: %s%%\n", progress); + LOGGER.infof("%s - Progress: %s%%\n", model.name(), progress); } } /** * @param lastUpdate The last update time in nanoseconds * Determines whether we should log an update. - * This is done in order to not overwhelm the console with updates which might make + * This is done in order to not overwhelm the console with updates which might + * make * canceling the download difficult. See - * this + * this */ private boolean logUpdate(Long lastUpdate) { if (lastUpdate == null) { return true; } else { return TimeUnit.NANOSECONDS.toMillis(System.nanoTime()) - - TimeUnit.NANOSECONDS.toMillis(lastUpdate) > 1_000; + - TimeUnit.NANOSECONDS.toMillis(lastUpdate) > 1_000; } } }));