Skip to content

Commit

Permalink
[docker] Fixes duplicated onnx jar file issue (#2017)
Browse files Browse the repository at this point in the history
  • Loading branch information
frankfliu authored Jun 4, 2024
1 parent 7f54a57 commit ee540be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
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

0 comments on commit ee540be

Please sign in to comment.