Closed DenisNovac closed 3 months ago
Oh i guess i found the solution. I've made this changes to Dockerfile:
FROM eclipse-temurin:17-jre-jammy
WORKDIR /opt/app
COPY ./target/scala-2.13/image-hosting-processing-recognizer-assembly-0.1.0-SNAPSHOT.jar ./app.jar
RUN mkdir /opt/app/nsfw
ENTRYPOINT ["java", "-cp", "app.jar", "com.github.baklanovsoft.imagehosting.recognizer.Main"]
And started to mount the model in compose:
volumes:
- recognizer1-djl-cache:/root/.djl.ai
- "./recognizer/synset.txt:/opt/app/nsfw/synset.txt"
- "./recognizer/nsfw_model.pt:/opt/app/nsfw/nsfw_model.pt"
But i guess the main reason is subfolder. I've been putting the model in the same folder as .jar file. I am not sure if it's a bug but feel free to close this ticket if it is expected.
Description
I am trying to pack pre-trained PyTorch model inside of a Docker container together with app written in Scala. (model loader code) The app works fine when running normally but in Docker i am getting following error. It looks like it can actually find the model but can't read it. Also this container runs fine when i use only DJL-provided models (such as MxNet's vgg16).
If i pass wrong model path - it fails with
No model with the specified URI or the matching Input/Output type is found.
so it actually sees the model when name is correct.Expected Behavior
Model is loaded successfully
Error Message
How to Reproduce?
I can upload the image but it seems pretty useless. The error doesn't happen when running from local machine.
Steps to reproduce
(Paste the commands you ran that produced the error.)
Environment Info
OS: Fedora 39 CPU: Core i7-7700HQ x86-64 JDK: tried both 11 and 17 Docker: 25.0.3
Here are my DJL dependencies:
And Dockerfile: