Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docker] Fixes duplicated onnx jar file issue #2017

Merged
merged 1 commit into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion serving/docker/lmi.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ RUN mv *.deb djl-serving_all.deb || true

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -yq libaio-dev libopenmpi-dev g++ && \
scripts/install_djl_serving.sh $djl_version && \
rm -f /usr/local/djl-serving-*/lib/onnxruntime-$onnx_version.jar && \
rm -f /usr/local/djl-serving-*/lib/onnxruntime-1.*.jar && \
curl -o $(ls -d /usr/local/djl-serving-*/)lib/onnxruntime_gpu-$onnx_version.jar https://publish.djl.ai/onnxruntime/$onnx_version/onnxruntime_gpu-$onnx_version.jar && \
mkdir -p /opt/djl/bin && cp scripts/telemetry.sh /opt/djl/bin && \
echo "${djl_version} lmi" > /opt/djl/bin/telemetry && \
Expand Down
7 changes: 5 additions & 2 deletions wlm/src/main/java/ai/djl/serving/wlm/LmiUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ private static Path convertOnnx(String modelId) throws IOException {
return repoDir;
}

Engine onnx = Engine.getEngine("OnnxRuntime");
boolean hasCuda = onnx.getGpuCount() > 0;

String[] cmd = {
"djl-convert",
"--output-dir",
Expand All @@ -181,9 +184,9 @@ private static Path convertOnnx(String modelId) throws IOException {
"-m",
modelId,
"--optimize",
CudaUtils.hasCuda() ? "O4" : "O2",
hasCuda ? "O4" : "O2",
"--device",
CudaUtils.hasCuda() ? "cuda" : "cpu"
hasCuda ? "cuda" : "cpu"
};
boolean success = false;
try {
Expand Down
Loading