Skip to content

Commit

Permalink
Add model name to progress log
Browse files Browse the repository at this point in the history
  • Loading branch information
geoand committed Nov 4, 2024
1 parent f550ec8 commit b476e73
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
* <a href="https://github.com/quarkiverse/quarkus-langchain4j/issues/1044">this</a>
* <a href=
* "https://github.com/quarkiverse/quarkus-langchain4j/issues/1044">this</a>
*/
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;
}
}
}));
Expand Down

0 comments on commit b476e73

Please sign in to comment.