Spaces:
Sleeping
Sleeping
Commit
·
7d2c2bd
1
Parent(s):
71441db
Fix: Workaround hardcoded /tmp/models path for YOLO
Browse files- Dockerfile +13 -3
Dockerfile
CHANGED
|
@@ -71,15 +71,25 @@ RUN . /opt/mineru_venv/bin/activate && \
|
|
| 71 |
sed -i 's|"device": "cpu"|"device": "cuda"|g' $HOME/magic-pdf.json
|
| 72 |
|
| 73 |
# Debug: Print the content of the user's config file
|
| 74 |
-
RUN echo "--- Contents of $HOME/magic-pdf.json --- " && cat $HOME/magic-pdf.json && echo "--- End of $HOME/magic-pdf.json --- "
|
| 75 |
|
| 76 |
-
# Switch back to root temporarily to
|
| 77 |
USER root
|
|
|
|
|
|
|
| 78 |
RUN cp $HOME/magic-pdf.json /root/magic-pdf.json && \
|
| 79 |
chown root:root /root/magic-pdf.json
|
| 80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
# Debug: Print the content of the root's config file
|
| 82 |
-
RUN echo "--- Contents of /root/magic-pdf.json --- " && cat /root/magic-pdf.json && echo "--- End of /root/magic-pdf.json --- "
|
| 83 |
|
| 84 |
# Switch back to the non-root user for running the app and copying files
|
| 85 |
USER user
|
|
|
|
| 71 |
sed -i 's|"device": "cpu"|"device": "cuda"|g' $HOME/magic-pdf.json
|
| 72 |
|
| 73 |
# Debug: Print the content of the user's config file
|
| 74 |
+
# RUN echo "--- Contents of $HOME/magic-pdf.json --- " && cat $HOME/magic-pdf.json && echo "--- End of $HOME/magic-pdf.json --- "
|
| 75 |
|
| 76 |
+
# Switch back to root temporarily to manage /root and /tmp
|
| 77 |
USER root
|
| 78 |
+
|
| 79 |
+
# Copy the final config to /root
|
| 80 |
RUN cp $HOME/magic-pdf.json /root/magic-pdf.json && \
|
| 81 |
chown root:root /root/magic-pdf.json
|
| 82 |
|
| 83 |
+
# Workaround: Copy YOLO model to the hardcoded path /tmp/models/...
|
| 84 |
+
# Find the actual downloaded model path in the cache (using wildcard for snapshot hash)
|
| 85 |
+
# Note: This assumes the download script places the model predictably within the user's cache.
|
| 86 |
+
RUN mkdir -p /tmp/models/MFD/YOLO && \
|
| 87 |
+
find $HOME/.cache/huggingface/hub -name yolo_v8_ft.pt -exec cp {} /tmp/models/MFD/YOLO/yolo_v8_ft.pt \; && \
|
| 88 |
+
chown -R user:user /tmp/models && \
|
| 89 |
+
chmod -R 755 /tmp/models
|
| 90 |
+
|
| 91 |
# Debug: Print the content of the root's config file
|
| 92 |
+
# RUN echo "--- Contents of /root/magic-pdf.json --- " && cat /root/magic-pdf.json && echo "--- End of /root/magic-pdf.json --- "
|
| 93 |
|
| 94 |
# Switch back to the non-root user for running the app and copying files
|
| 95 |
USER user
|