davanstrien HF Staff commited on
Commit
4b426fb
·
verified ·
1 Parent(s): b52a8fb

Sync from GitHub via hub-sync

Browse files
Files changed (2) hide show
  1. deepseek-ocr-vllm.py +15 -7
  2. deepseek-ocr2-vllm.py +14 -12
deepseek-ocr-vllm.py CHANGED
@@ -4,11 +4,16 @@
4
  # "datasets>=4.0.0",
5
  # "huggingface-hub",
6
  # "pillow",
7
- # "vllm>=0.15.1",
8
  # "tqdm",
9
  # "toolz",
10
- # "torch",
11
  # ]
 
 
 
 
 
 
 
12
  # ///
13
 
14
  """
@@ -21,8 +26,11 @@ Uses the official vLLM offline pattern: llm.generate() with PIL images
21
  and NGramPerReqLogitsProcessor to prevent repetition on complex documents.
22
  See: https://docs.vllm.ai/projects/recipes/en/latest/DeepSeek/DeepSeek-OCR.html
23
 
24
- NOTE: Uses vLLM nightly wheels. First run may take a few minutes to download
25
- and install dependencies.
 
 
 
26
 
27
  Features:
28
  - LaTeX equation recognition
@@ -473,8 +481,8 @@ if __name__ == "__main__":
473
  " uv run deepseek-ocr-vllm.py large-dataset test-output --max-samples 10"
474
  )
475
  print("\n5. Running on HF Jobs:")
476
- print(" hf jobs uv run --flavor l4x1 \\")
477
- print(" -s HF_TOKEN \\")
478
  print(
479
  " https://huggingface.co/datasets/uv-scripts/ocr/raw/main/deepseek-ocr-vllm.py \\"
480
  )
@@ -512,7 +520,7 @@ Examples:
512
  uv run deepseek-ocr-vllm.py dataset output --batch-size 16 --max-model-len 16384
513
 
514
  # Running on HF Jobs
515
- hf jobs uv run --flavor l4x1 -s HF_TOKEN \\
516
  https://huggingface.co/datasets/uv-scripts/ocr/raw/main/deepseek-ocr-vllm.py \\
517
  my-dataset my-output --max-samples 10
518
  """,
 
4
  # "datasets>=4.0.0",
5
  # "huggingface-hub",
6
  # "pillow",
 
7
  # "tqdm",
8
  # "toolz",
 
9
  # ]
10
+ #
11
+ # [tool.hf-jobs]
12
+ # image = "vllm/vllm-openai:v0.29.0"
13
+ # python = "/usr/bin/python3"
14
+ # env = { PYTHONPATH = "/usr/local/lib/python3.12/dist-packages" }
15
+ # flavor = "a10g-small"
16
+ # secrets = ["HF_TOKEN"]
17
  # ///
18
 
19
  """
 
26
  and NGramPerReqLogitsProcessor to prevent repetition on complex documents.
27
  See: https://docs.vllm.ai/projects/recipes/en/latest/DeepSeek/DeepSeek-OCR.html
28
 
29
+ Run on HF Jobs. vLLM and torch come from the vllm/vllm-openai:v0.29.0 image declared
30
+ in the [tool.hf-jobs] header (`hf` CLI 1.32+), which also sets the hardware and the
31
+ HF_TOKEN secret. The tag is pinned: vLLM 0.30 breaks the DeepEncoder Triton kernel
32
+ (LOG2E NameError), and nightly wheels moved the logits-processor API. Pass --timeout
33
+ for a long run. To run on your own GPU: `uv run --with vllm==0.29.0 deepseek-ocr-vllm.py ...`.
34
 
35
  Features:
36
  - LaTeX equation recognition
 
481
  " uv run deepseek-ocr-vllm.py large-dataset test-output --max-samples 10"
482
  )
483
  print("\n5. Running on HF Jobs:")
484
+ print(" (image, hardware and HF_TOKEN come from the script's [tool.hf-jobs] header)")
485
+ print(" hf jobs uv run \\")
486
  print(
487
  " https://huggingface.co/datasets/uv-scripts/ocr/raw/main/deepseek-ocr-vllm.py \\"
488
  )
 
520
  uv run deepseek-ocr-vllm.py dataset output --batch-size 16 --max-model-len 16384
521
 
522
  # Running on HF Jobs
523
+ hf jobs uv run \\
524
  https://huggingface.co/datasets/uv-scripts/ocr/raw/main/deepseek-ocr-vllm.py \\
525
  my-dataset my-output --max-samples 10
526
  """,
deepseek-ocr2-vllm.py CHANGED
@@ -4,19 +4,18 @@
4
  # "datasets>=4.0.0",
5
  # "huggingface-hub",
6
  # "pillow",
7
- # "vllm",
8
  # "tqdm",
9
  # "toolz",
10
- # "torch",
11
  # "addict",
12
  # "matplotlib",
13
  # ]
14
  #
15
- # [[tool.uv.index]]
16
- # url = "https://wheels.vllm.ai/nightly/cu129"
17
- #
18
- # [tool.uv]
19
- # prerelease = "allow"
 
20
  # ///
21
 
22
  """
@@ -30,8 +29,11 @@ Uses the official vLLM offline pattern: llm.generate() with PIL images
30
  and NGramPerReqLogitsProcessor to prevent repetition on complex documents.
31
  See: https://docs.vllm.ai/projects/recipes/en/latest/DeepSeek/DeepSeek-OCR.html
32
 
33
- NOTE: Uses vLLM nightly wheels. First run may take a few minutes to download
34
- and install dependencies.
 
 
 
35
 
36
  Features:
37
  - Visual Causal Flow architecture for enhanced visual encoding
@@ -498,8 +500,8 @@ if __name__ == "__main__":
498
  " uv run deepseek-ocr2-vllm.py large-dataset test-output --max-samples 10"
499
  )
500
  print("\n4. Running on HF Jobs:")
501
- print(" hf jobs uv run --flavor l4x1 \\")
502
- print(" -s HF_TOKEN \\")
503
  print(
504
  " https://huggingface.co/datasets/uv-scripts/ocr/raw/main/deepseek-ocr2-vllm.py \\"
505
  )
@@ -531,7 +533,7 @@ Examples:
531
  uv run deepseek-ocr2-vllm.py dataset output --batch-size 16 --max-model-len 16384
532
 
533
  # Running on HF Jobs
534
- hf jobs uv run --flavor l4x1 -s HF_TOKEN \\
535
  https://huggingface.co/datasets/uv-scripts/ocr/raw/main/deepseek-ocr2-vllm.py \\
536
  my-dataset my-output --max-samples 10
537
  """,
 
4
  # "datasets>=4.0.0",
5
  # "huggingface-hub",
6
  # "pillow",
 
7
  # "tqdm",
8
  # "toolz",
 
9
  # "addict",
10
  # "matplotlib",
11
  # ]
12
  #
13
+ # [tool.hf-jobs]
14
+ # image = "vllm/vllm-openai:v0.29.0"
15
+ # python = "/usr/bin/python3"
16
+ # env = { PYTHONPATH = "/usr/local/lib/python3.12/dist-packages" }
17
+ # flavor = "a10g-small"
18
+ # secrets = ["HF_TOKEN"]
19
  # ///
20
 
21
  """
 
29
  and NGramPerReqLogitsProcessor to prevent repetition on complex documents.
30
  See: https://docs.vllm.ai/projects/recipes/en/latest/DeepSeek/DeepSeek-OCR.html
31
 
32
+ Run on HF Jobs. vLLM and torch come from the vllm/vllm-openai:v0.29.0 image declared
33
+ in the [tool.hf-jobs] header (`hf` CLI 1.32+), which also sets the hardware and the
34
+ HF_TOKEN secret. The tag is pinned: vLLM 0.30 breaks the DeepEncoder Triton kernel
35
+ (LOG2E NameError), and nightly wheels moved the logits-processor API. Pass --timeout
36
+ for a long run. To run on your own GPU: `uv run --with vllm==0.29.0 deepseek-ocr2-vllm.py ...`.
37
 
38
  Features:
39
  - Visual Causal Flow architecture for enhanced visual encoding
 
500
  " uv run deepseek-ocr2-vllm.py large-dataset test-output --max-samples 10"
501
  )
502
  print("\n4. Running on HF Jobs:")
503
+ print(" (image, hardware and HF_TOKEN come from the script's [tool.hf-jobs] header)")
504
+ print(" hf jobs uv run \\")
505
  print(
506
  " https://huggingface.co/datasets/uv-scripts/ocr/raw/main/deepseek-ocr2-vllm.py \\"
507
  )
 
533
  uv run deepseek-ocr2-vllm.py dataset output --batch-size 16 --max-model-len 16384
534
 
535
  # Running on HF Jobs
536
+ hf jobs uv run \\
537
  https://huggingface.co/datasets/uv-scripts/ocr/raw/main/deepseek-ocr2-vllm.py \\
538
  my-dataset my-output --max-samples 10
539
  """,