Florent Gbelidji commited on
Commit
1afa3c2
·
verified ·
1 Parent(s): 21b955b

Sync DeepSeek OCR HF job code

Browse files
Files changed (2) hide show
  1. ds_batch_ocr/server.py +8 -1
  2. ds_batch_ocr/stages.py +9 -10
ds_batch_ocr/server.py CHANGED
@@ -52,7 +52,14 @@ def launch_vllm() -> subprocess.Popen:
52
  "--host",
53
  host,
54
  "--trust-remote-code",
55
- "--enable-chunked-prefill",
 
 
 
 
 
 
 
56
  ]
57
 
58
  extra_server_args = os.environ.get("EXTRA_VLLM_ARGS")
 
52
  "--host",
53
  host,
54
  "--trust-remote-code",
55
+ "--no-enable-prefix-caching",
56
+ "--mm-processor-cache-gb",
57
+ os.environ.get("MM_PROCESSOR_CACHE_GB", "0"),
58
+ "--logits-processors",
59
+ os.environ.get(
60
+ "LOGITS_PROCESSORS",
61
+ "vllm.model_executor.models.deepseek_ocr.NGramPerReqLogitsProcessor",
62
+ ),
63
  ]
64
 
65
  extra_server_args = os.environ.get("EXTRA_VLLM_ARGS")
ds_batch_ocr/stages.py CHANGED
@@ -154,18 +154,17 @@ def run_stage_extract(settings: ExtractSettings) -> None:
154
  sample_dir.mkdir(parents=True, exist_ok=True)
155
 
156
  raw_image = sample["images"][0]
157
- if isinstance(raw_image, Image.Image):
158
- image = raw_image.copy()
159
- else:
160
- image = Image.fromarray(raw_image)
161
 
162
- if hasattr(raw_image, "close"):
163
- try:
164
- raw_image.close()
165
- except Exception: # pragma: no cover - defensive cleanup
166
- pass
167
 
168
- image = ImageOps.exif_transpose(image)
169
  if image.mode != "RGB":
170
  image = image.convert("RGB")
171
 
 
154
  sample_dir.mkdir(parents=True, exist_ok=True)
155
 
156
  raw_image = sample["images"][0]
157
+ # if isinstance(raw_image, Image.Image):
158
+ # image = raw_image.copy()
159
+ # else:
160
+ # image = Image.fromarray(raw_image)
161
 
162
+ # if hasattr(raw_image, "close"):
163
+ # try:
164
+ # raw_image.close()
165
+ # except Exception: # pragma: no cover - defensive cleanup
166
+ # pass
167
 
 
168
  if image.mode != "RGB":
169
  image = image.convert("RGB")
170