omgy commited on
Commit
19689ad
·
verified ·
1 Parent(s): 917fb56

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -31
Dockerfile CHANGED
@@ -33,39 +33,15 @@ COPY . .
33
  ENV FVCORE_CACHE=/root/.torch/iopath_cache
34
  ENV TORCH_HOME=/root/.torch
35
 
36
- # Create cache directories
37
  RUN mkdir -p /root/.torch/iopath_cache/s/dgy9c10wykk4lq4 && \
38
  mkdir -p /root/.torch/iopath_cache/s/u9t7pqwz79q8kw5 && \
39
- mkdir -p /root/.torch/fvcore_cache && \
40
- chmod -R 777 /root/.torch
41
-
42
- # Download model and config, then rename to remove query parameters
43
- RUN cd /root/.torch/iopath_cache/s/dgy9c10wykk4lq4 && \
44
- wget -q --show-progress https://www.dropbox.com/s/dgy9c10wykk4lq4/model_final.pth?dl=1 && \
45
- mv "model_final.pth?dl=1" model_final.pth && \
46
- echo "✓ Model weights downloaded and renamed"
47
-
48
- RUN cd /root/.torch/iopath_cache/s/u9t7pqwz79q8kw5 && \
49
- wget -q --show-progress https://www.dropbox.com/s/u9t7pqwz79q8kw5/config.yml?dl=1 && \
50
- mv "config.yml?dl=1" config.yml && \
51
- echo "✓ Config file downloaded and renamed"
52
-
53
- # Verify the files exist with correct names
54
- RUN ls -lh /root/.torch/iopath_cache/s/dgy9c10wykk4lq4/ && \
55
- ls -lh /root/.torch/iopath_cache/s/u9t7pqwz79q8kw5/
56
-
57
- # Verify the model can be loaded
58
- RUN python3 -c "import os; \
59
- os.environ['FVCORE_CACHE'] = '/root/.torch/iopath_cache'; \
60
- os.environ['TORCH_HOME'] = '/root/.torch'; \
61
- import layoutparser as lp; \
62
- print('Testing model load...'); \
63
- model = lp.Detectron2LayoutModel(\
64
- 'lp://PubLayNet/faster_rcnn_R_50_FPN_3x/config',\
65
- extra_config=['MODEL.ROI_HEADS.SCORE_THRESH_TEST', 0.5],\
66
- label_map={0: 'Text', 1: 'Title', 2: 'List', 3: 'Table', 4: 'Figure'},\
67
- ); \
68
- print('✓ Model loaded successfully')"
69
 
70
  EXPOSE 8080
71
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080"]
 
33
  ENV FVCORE_CACHE=/root/.torch/iopath_cache
34
  ENV TORCH_HOME=/root/.torch
35
 
36
+ # Create cache directories and download models with proper naming
37
  RUN mkdir -p /root/.torch/iopath_cache/s/dgy9c10wykk4lq4 && \
38
  mkdir -p /root/.torch/iopath_cache/s/u9t7pqwz79q8kw5 && \
39
+ chmod -R 777 /root/.torch && \
40
+ wget -q --show-progress https://www.dropbox.com/s/dgy9c10wykk4lq4/model_final.pth?dl=1 \
41
+ -O /root/.torch/iopath_cache/s/dgy9c10wykk4lq4/model_final.pth && \
42
+ wget -q --show-progress https://www.dropbox.com/s/u9t7pqwz79q8kw5/config.yml?dl=1 \
43
+ -O /root/.torch/iopath_cache/s/u9t7pqwz79q8kw5/config.yml && \
44
+ echo "✓ Model files downloaded successfully"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
 
46
  EXPOSE 8080
47
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080"]