Andhs commited on
Commit
4b7a527
·
verified ·
1 Parent(s): b7125bf

Upload 2 files

Browse files
Files changed (2) hide show
  1. Dockerfile +10 -13
  2. app.py +0 -5
Dockerfile CHANGED
@@ -1,6 +1,5 @@
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
 
@@ -8,30 +7,27 @@ 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/ZHZisZZ/dllm.git /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
@@ -41,3 +37,4 @@ EXPOSE 7860
41
 
42
  CMD ["python", "app.py"]
43
 
 
 
1
  FROM pytorch/pytorch:2.6.0-cuda12.4-cudnn9-devel
2
 
 
3
  USER root
4
  WORKDIR /app
5
 
 
7
  git \
8
  && rm -rf /var/lib/apt/lists/*
9
 
10
+ # 1. Clone into an isolated directory
11
+ RUN git clone --recurse-submodules https://github.com/ZHZisZZ/dllm.git /tmp/dllm-build
12
 
13
+ # 2. Build and install globally into site-packages (NO editable mode flags)
14
+ RUN pip install --no-cache-dir /tmp/dllm-build && \
15
+ pip install --no-cache-dir /tmp/dllm-build/lm-evaluation-harness && \
16
+ rm -rf /tmp/dllm-build
17
 
18
+ # 3. Clean up additional pip requirements
19
  COPY requirements.txt .
20
  RUN pip install --no-cache-dir -r requirements.txt
21
 
 
22
  COPY app.py .
23
 
24
+ # 4. HF Spaces Permission Compliance
 
25
  RUN useradd -m -u 1000 user && \
26
  chown -R user:user /app
 
27
  USER user
28
+
29
  ENV HOME=/home/user
30
  ENV PATH=/home/user/.local/bin:$PATH
 
 
31
  ENV HF_HOME=/home/user/.cache/huggingface
32
 
33
  ENV MODEL_NAME=dllm-hub/Qwen3-0.6B-diffusion-bd3lm-v0.1
 
37
 
38
  CMD ["python", "app.py"]
39
 
40
+
app.py CHANGED
@@ -1,9 +1,4 @@
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
 
1
  import os
 
 
 
 
 
2
  import math
3
  import copy
4
  import json