Spaces:
Running on Zero
Running on Zero
Add AGENTS operational notes for Spaces secrets and GPU abort debugging
Browse files
AGENTS.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Operational Notes (DeepSeek-OCR-Demo)
|
| 2 |
+
|
| 3 |
+
## Hugging Face token handling
|
| 4 |
+
- `HF_TOKEN` is **not** present by default in shell env.
|
| 5 |
+
- Local HF CLI token exists at `~/.cache/huggingface/token` (used as local fallback).
|
| 6 |
+
- Repo now includes:
|
| 7 |
+
- `.gitignore` (ignores `.env` and local caches)
|
| 8 |
+
- `.env.example` (`HF_TOKEN=...` placeholder only)
|
| 9 |
+
- `scripts/fetch_space_logs.sh` (Spaces log fetch helper)
|
| 10 |
+
|
| 11 |
+
## Spaces-compatible secret pattern
|
| 12 |
+
- Preferred: set `HF_TOKEN` in **Space Settings -> Variables and secrets**.
|
| 13 |
+
- Local dev: `cp .env.example .env`, set `HF_TOKEN`, then:
|
| 14 |
+
- `set -a; . ./.env; set +a`
|
| 15 |
+
|
| 16 |
+
## Space log access
|
| 17 |
+
- Run logs:
|
| 18 |
+
- `./scripts/fetch_space_logs.sh ricklon/DeepSeek-OCR-2-Math run`
|
| 19 |
+
- Build logs:
|
| 20 |
+
- `./scripts/fetch_space_logs.sh ricklon/DeepSeek-OCR-2-Math build`
|
| 21 |
+
|
| 22 |
+
## Current findings from logs
|
| 23 |
+
- Build logs looked healthy for commit `d6afca6` (no build failure seen).
|
| 24 |
+
- Run logs show normal startup and large model download/initialization.
|
| 25 |
+
- Observed warning:
|
| 26 |
+
- Flash Attention warning about model init on CPU before GPU move.
|
| 27 |
+
- This warning was already expected in this app flow and not by itself a crash.
|
| 28 |
+
- Observed `GPU task aborted` in UI, but abort stack line was not yet captured in the streamed snippet.
|
| 29 |
+
|
| 30 |
+
## Likely runtime risk (not yet conclusively proven)
|
| 31 |
+
- `@spaces.GPU(duration=90)` may be too short for heavy pages now that equation refinement can trigger multiple extra inferences.
|
| 32 |
+
- If abort repeats under load, first mitigation to try is increasing GPU duration for `process_image`/`process_pdf`.
|
| 33 |
+
|
| 34 |
+
## Region OCR feature status
|
| 35 |
+
- Region OCR UI was added with `gr.ImageEditor` behind a compatibility guard:
|
| 36 |
+
- `HAS_IMAGE_EDITOR = hasattr(gr, "ImageEditor")`
|
| 37 |
+
- Space config is `sdk_version: 6.8.0`, which should support `ImageEditor`.
|