@@ -10,6 +10,14 @@ RUN apt-get install python3 python3-pip python3-dev -y
10
10
# Upgrade pip
11
11
RUN pip install --no-cache-dir --upgrade pip
12
12
13
+ # Set the device on which the model should load e.g., "cpu", "cuda:0", etc.
14
+ ENV JAILBREAK_CHECK_DEVICE=cuda:0
15
+
16
+ # Predownload embedding-based jailbreak detection models, set environment variable for path
17
+ WORKDIR /models
18
+ RUN wget https://huggingface.co/nvidia/NemoGuard-JailbreakDetect/resolve/main/snowflake.pkl
19
+ ENV EMBEDDING_CLASSIFIER_PATH=/models
20
+
13
21
# Set working directory
14
22
WORKDIR /app
15
23
@@ -24,20 +32,9 @@ COPY . .
24
32
# Predownload the GPT2 model.
25
33
RUN python3 -c "from transformers import GPT2LMHeadModel, GPT2TokenizerFast; GPT2LMHeadModel.from_pretrained('gpt2-large'); GPT2TokenizerFast.from_pretrained('gpt2-large');"
26
34
27
- # Set the device on which the model should load e.g., "cpu", "cuda:0", etc.
28
- ENV JAILBREAK_CHECK_DEVICE=cuda:0
29
-
30
- # Predownload embedding-based jailbreak detection models, set environment variable for path
31
- WORKDIR /models
32
- RUN wget https://huggingface.co/nvidia/NemoGuard-JailbreakDetect/resolve/main/snowflake.pkl
33
- ENV EMBEDDING_CLASSIFIER_PATH=/models
34
-
35
- # To use nvidia/nv-embedqa-e5-v5 model, uncomment the line below and set your API key
36
- # ENV NVIDIA_API_KEY=<your_api_key>
37
-
38
35
# Expose a port for the server
39
36
EXPOSE 1337
40
37
41
38
# Start the server as the default command
42
- ENTRYPOINT ["/usr/local/bin/python", "server.py"]
39
+ ENTRYPOINT ["/usr/local/bin/python", "/app/ server.py"]
43
40
CMD ["--port=1337"]
0 commit comments