Andhs commited on
Commit
a0b1374
·
verified ·
1 Parent(s): 0758411

Upload 3 files

Browse files
Files changed (3) hide show
  1. Dockerfile +25 -4
  2. app.py +5 -0
  3. requirements.txt +0 -1
Dockerfile CHANGED
@@ -1,22 +1,43 @@
1
  FROM pytorch/pytorch:2.6.0-cuda12.4-cudnn9-devel
2
 
 
 
3
  WORKDIR /app
4
 
5
  RUN apt-get update && apt-get install -y \
6
  git \
7
  && rm -rf /var/lib/apt/lists/*
8
 
9
- RUN git clone --recurse-submodules https://github.com/ZHZisZZ/dllm.git /tmp/dllm && \
10
- pip install --no-cache-dir -e /tmp/dllm && \
11
- pip install --no-cache-dir -e /tmp/dllm/lm-evaluation-harness
12
 
13
- RUN pip install --no-cache-dir flask
 
 
14
 
 
 
 
 
 
15
  COPY app.py .
16
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  ENV MODEL_NAME=dllm-hub/Qwen3-0.6B-diffusion-bd3lm-v0.1
18
  ENV PORT=7860
19
 
20
  EXPOSE 7860
21
 
22
  CMD ["python", "app.py"]
 
 
1
  FROM pytorch/pytorch:2.6.0-cuda12.4-cudnn9-devel
2
 
3
+ # 1. System prerequisites setup as Root
4
+ USER root
5
  WORKDIR /app
6
 
7
  RUN apt-get update && apt-get install -y \
8
  git \
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
+ # Clone framework natively into an application staging directory
12
+ RUN git clone --recurse-submodules https://github.com /app/dllm-source
 
13
 
14
+ # Install the library globally so it compiles securely across all user sessions
15
+ RUN pip install --no-cache-dir /app/dllm-source && \
16
+ pip install --no-cache-dir /app/dllm-source/lm-evaluation-harness
17
 
18
+ # Install remaining Python package prerequisites
19
+ COPY requirements.txt .
20
+ RUN pip install --no-cache-dir -r requirements.txt
21
+
22
+ # Copy deployment script
23
  COPY app.py .
24
 
25
+ # 2. Hugging Face Spaces Sandbox Compliance
26
+ # Set up a generic user mapping to UID 1000
27
+ RUN useradd -m -u 1000 user && \
28
+ chown -R user:user /app
29
+
30
+ USER user
31
+ ENV HOME=/home/user
32
+ ENV PATH=/home/user/.local/bin:$PATH
33
+
34
+ # Direct Hugging Face cache downloads into a writeable workspace location
35
+ ENV HF_HOME=/home/user/.cache/huggingface
36
+
37
  ENV MODEL_NAME=dllm-hub/Qwen3-0.6B-diffusion-bd3lm-v0.1
38
  ENV PORT=7860
39
 
40
  EXPOSE 7860
41
 
42
  CMD ["python", "app.py"]
43
+
app.py CHANGED
@@ -1,4 +1,9 @@
1
  import os
 
 
 
 
 
2
  import math
3
  import copy
4
  import json
 
1
  import os
2
+ import sys
3
+
4
+ # Resolves relative module routes for trust_remote_code executors
5
+ sys.path.append(os.path.abspath("/app/dllm-source"))
6
+
7
  import math
8
  import copy
9
  import json
requirements.txt CHANGED
@@ -3,4 +3,3 @@ torch
3
  transformers
4
  accelerate
5
  numpy<2.0
6
- git+https://github.com/ZHZisZZ/dllm.git
 
3
  transformers
4
  accelerate
5
  numpy<2.0