nz-nz commited on
Commit
f61035c
·
verified ·
1 Parent(s): 058157a

Sync from GitHub via hub-sync

Browse files
Files changed (2) hide show
  1. requirements-model.txt +12 -45
  2. requirements.txt +15 -0
requirements-model.txt CHANGED
@@ -1,48 +1,15 @@
1
- # Real-model dependencies — only needed when RECALL_STUB=0.
2
- # Superset of the light demo set. Install with:
3
- # pip install -r requirements-model.txt
4
  #
5
- # Target: openbmb/MiniCPM-V-4.6 (multimodal, ~9B) to read image-only / scanned
6
- # PDFs. Aligned with the official Space (openbmb/MiniCPM-V-4.6-Demo), which runs
7
- # the same custom-frontend gradio.Server + ZeroGPU pattern as this app.
 
 
8
  #
9
- # DEPLOY (real model on the Space):
10
- # * Fold these into requirements.txt for the model deploy (a Gradio Space
11
- # installs requirements.txt, not this file) see NAH-7.
12
- # * Switch hardware back to ZeroGPU AND register the inference under @spaces.GPU,
13
- # and name the gradio.Server `demo` a ZeroGPU Space with no @spaces.GPU fn
14
- # flips to RUNTIME_ERROR (that's why the stub demo runs on CPU; see server.py).
15
  -r requirements.txt
16
-
17
- # --- transformers / model ---
18
- # MiniCPM-V 4.6 is a NATIVE transformers architecture
19
- # (`from transformers import MiniCPMV4_6ForConditionalGeneration`), so it needs a
20
- # recent transformers (5.x) — NOT the old trust_remote_code path. The official
21
- # demo declares `transformers>=4.44.0` and relies on latest providing the class.
22
- #
23
- # NOTE: this DROPS the previous `transformers<5.0` cap. That cap existed only for
24
- # the old MiniCPM4.1-8B *text* model (its trust_remote_code broke on 5.x, forcing
25
- # huggingface-hub<1.0). 4.6 uses new transformers (hub>=1.0), and gradio==6.10.0
26
- # allows hub<2.0, so gradio 6.10.0 + transformers 5.x + hub 1.x resolve together.
27
- # Moving to 4.6 therefore RETIRES the old MiniCPM4.1-8B / hub<1.0 constraint.
28
- transformers>=4.44.0
29
- torch
30
- torchvision # vision tower; must match the installed torch
31
- accelerate
32
- sentencepiece # tokenizer backend the MiniCPM-V processor uses
33
-
34
- # --- image + PDF handling ---
35
- pillow # images are passed to the model as PIL.Image objects
36
- # Render image-only / scanned PDF pages -> PIL images to feed the vision model.
37
- # PyMuPDF is a pure wheel (no poppler/ffmpeg system dep) — works on a Space as-is.
38
- # (Neither MiniCPM demo does PDFs; this is our addition for image-based PDFs.)
39
- PyMuPDF
40
-
41
- # --- video (OPTIONAL) ---
42
- # Only needed if you later accept video input. Requires the `ffmpeg` system package
43
- # (add a packages.txt with `ffmpeg`). Not needed for image-based PDFs, so left out:
44
- # av
45
-
46
- # HF ZeroGPU GPU decorator (effect-free off-Space). Pulls in gradio, so it must
47
- # resolve against the gradio pin in requirements.txt — not the latest gradio.
48
- spaces
 
1
+ # Real-model dependencies.
 
 
2
  #
3
+ # These are now FOLDED INTO requirements.txt, because the Space serves the live
4
+ # MiniCPM-V 4.6 model (ZeroGPU, RECALL_STUB=0) and a Gradio Space installs
5
+ # requirements.txt not this file. So requirements.txt is the single source of
6
+ # truth for the real-model deps (transformers 5.x, torch, torchvision, accelerate,
7
+ # sentencepiece, pillow, PyMuPDF, spaces); this file just installs it.
8
  #
9
+ # Why the gradio==6.10.0 pin still holds with modern transformers: 6.10.0 allows
10
+ # huggingface-hub<2.0 (i.e. hub 1.x), which MiniCPM-V 4.6's transformers 5.x wants.
11
+ # Do NOT move to MiniCPM-V 4.6+ versions needing a different stack without
12
+ # re-checking the resolve (verified on an HF Job: gradio 6.10 + transformers 5.12
13
+ # + hub 1.19 + torch 2.12). MiniCPM-V is loaded via the native
14
+ # MiniCPMV4_6ForConditionalGeneration class (trust_remote_code=True).
15
  -r requirements.txt
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
requirements.txt CHANGED
@@ -31,3 +31,18 @@ uvicorn
31
  python-multipart
32
  # PDF text extraction (pure-python, lightweight).
33
  pypdf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  python-multipart
32
  # PDF text extraction (pure-python, lightweight).
33
  pypdf
34
+
35
+ # --- Real model (MiniCPM-V 4.6), folded in for the LIVE real-model deploy -----
36
+ # A gradio Space installs THIS file (not requirements-model.txt), so the heavy
37
+ # deps live here now that the Space serves the real model on ZeroGPU with
38
+ # RECALL_STUB=0. Verified to resolve with gradio==6.10.0 (HF Job, l4x1):
39
+ # transformers 5.12 + huggingface-hub 1.19 + torch 2.12. See requirements-model.txt
40
+ # for the rationale; keep the two in lockstep.
41
+ transformers>=4.44.0 # native MiniCPMV4_6ForConditionalGeneration (latest 5.x)
42
+ torch
43
+ torchvision # vision tower; must match torch
44
+ accelerate
45
+ sentencepiece # MiniCPM-V tokenizer backend
46
+ pillow # images passed to the model as PIL.Image
47
+ PyMuPDF # render scanned/image-only PDF pages -> images
48
+ spaces # HF ZeroGPU @spaces.GPU decorator