Spaces:
Sleeping
Sleeping
File size: 4,638 Bytes
a38026a 10580aa a38026a 10580aa a38026a 10580aa a38026a 10580aa a38026a 10580aa a38026a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | # FIX.md β How to Stop All Startup Errors
The logs show the OLD engine code is still running. The files from the previous
session were not copied into the project. Do these steps in order.
---
## Step 1 β Replace fingerprint engine
Copy `fingerprint_engine.py` (from outputs) to:
```
src/engines/fingerprint/engine.py
```
This removes all broken legacy models and fixes the `trust_remote_code`
duplicate kwarg bug.
Replaces with 3 working models:
- `Organika/sdxl-detector`
- `haywoodsloan/ai-image-detector-deploy`
- `dima806/deepfake_vs_real_image_detection`
---
## Step 2 β Replace coherence engine
Copy `coherence_engine.py` (from outputs) to:
```
src/engines/coherence/engine.py
```
This removes the broken wav2vec-based audio model path with incompatible
weights and random output behavior. Coherence now runs visual-only (FaceNet +
MediaPipe).
---
## Step 3 β Replace SSTGNN engine
Copy `sstgnn_engine.py` (from outputs) to:
```
src/engines/sstgnn/engine.py
```
Removes legacy ViT `.pt` checkpoint usage. Uses `dima806` + `prithivMLmods`
only.
---
## Step 4 β Fix the Dockerfile (libGLESv2 error)
Replace your `Dockerfile` with this exactly:
```dockerfile
FROM python:3.11-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg \
libgl1 \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender1 \
libgles2 \
libegl1 \
libgbm1 \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
COPY . .
ENV MODEL_CACHE_DIR=/data/models
ENV TOKENIZERS_PARALLELISM=false
ENV MESA_GL_VERSION_OVERRIDE=3.3
ENV PYOPENGL_PLATFORM=egl
ENV PYTHONUNBUFFERED=1
EXPOSE 7860
CMD ["python", "spaces/app.py"]
```
The key additions are `libgles2 libegl1 libgbm1` β MediaPipe requires OpenGL ES
even for CPU-only inference. Without these packages it always throws
`libGLESv2.so.2: cannot open shared object file`.
---
## Step 5 β Fix requirements.txt (torch CVE block)
Replace the torch lines in `requirements.txt`:
```
torch>=2.6.0
torchvision>=0.21.0
torchaudio>=2.6.0
```
Torch < 2.6 blocks loading `.pt` files due to CVE-2025-32434. Since legacy
`.pt` checkpoints are removed, this is still a safety measure for other
dependencies that may call `torch.load`.
---
## Step 6 β Rebuild and redeploy
```bash
# If running locally / Docker:
docker build --no-cache -t genai-deepdetect .
docker run -p 7860:7860 genai-deepdetect
# If on HuggingFace Spaces:
git add src/engines/fingerprint/engine.py
git add src/engines/coherence/engine.py
git add src/engines/sstgnn/engine.py
git add Dockerfile
git add requirements.txt
git commit -m "fix: remove broken models, add libgles2 for mediapipe"
git push
```
HF Spaces will rebuild the Docker image automatically on push. Watch the build
logs β the apt-get install should now include libgles2.
---
## What the fixed startup should look like
```
Fingerprint engine: loading models...
β detector: Organika/sdxl-detector
β detector: haywoodsloan/ai-image-detector-deploy
β detector: dima806/deepfake_vs_real_image_detection
β CLIP ViT-L/14 loaded for generator attribution
Fingerprint engine ready: 3 detectors, CLIP=ok
Coherence engine: loading models...
β FaceNet MTCNN + InceptionResnetV1 (VGGFace2) loaded
β MediaPipe FaceMesh loaded β only works after Dockerfile fix
Coherence engine ready: facenet=ok, mediapipe=ok
SSTGNN engine: loading models...
β SSTGNN detector: dima806/deepfake_vs_real_image_detection
β SSTGNN detector: prithivMLmods/Deep-Fake-Detector-Model
β MediaPipe FaceMesh loaded for SSTGNN graph
SSTGNN engine ready: 2 detectors, mediapipe=ok
```
---
## Summary
| Error | Cause | Fix |
| --------------------------------- | ------------------------------------------- | --------------------------------- |
| Legacy GenD warnings | custom architecture | removed from engine |
| Legacy ViT torch CVE error | `.pt` file + torch < 2.6 | removed from engine |
| `trust_remote_code` TypeError | duplicate kwarg in \_build_image_classifier | removed from all pipeline() calls |
| `wav2vec` MISSING/UNEXPECTED keys | custom m_ssl.\* namespace, incompatible | removed from engine |
| `libGLESv2.so.2 not found` | missing apt packages in Docker | add libgles2 libegl1 libgbm1 |
|