davanstrien HF Staff commited on
Commit
3348442
·
verified ·
1 Parent(s): 3599946

Sync from GitHub via hub-sync

Browse files
Files changed (3) hide show
  1. README.md +4 -3
  2. qwen3vl-detect-fewshot.py +14 -8
  3. qwen3vl-detect.py +14 -8
README.md CHANGED
@@ -34,7 +34,7 @@ The script name says `qwen3vl` because the bbox-output convention (`bbox_2d` JSO
34
 
35
  ```bash
36
  hf jobs uv run \
37
- --image vllm/vllm-openai:latest \
38
  --flavor a100-large \
39
  --python /usr/bin/python3 \
40
  -e PYTHONPATH=/usr/local/lib/python3.12/dist-packages \
@@ -121,13 +121,14 @@ not return overlapping or duplicate boxes.
121
 
122
  ## Hardware notes
123
 
124
- - **A100-large + `vllm/vllm-openai:latest` image** is the working combo. The default uv-script image installs PyPI's latest PyTorch, which has a CUDA driver mismatch on a100 hosts (driver 12.9, PyTorch wants newer). Workaround: `--image vllm/vllm-openai:latest --python /usr/bin/python3 -e PYTHONPATH=/usr/local/lib/python3.12/dist-packages` (uses the image's pre-installed driver-compatible torch + vllm).
 
125
  - **H200 was unreliable** in our testing — flashinfer's runtime JIT compile of cutlass kernels for `compute_90a` failed in the same image. Stick with A100 for now.
126
  - **`max_num_seqs` is auto-capped to `batch_size`**. Qwen3.6's hybrid Gated-DeltaNet architecture allocates per-sequence SSM cache blocks; vLLM's default 256 can exceed available blocks and crash CUDA graph capture. We never decode > batch_size concurrently anyway.
127
 
128
  ## CLI reference
129
 
130
- Run `uv run qwen3vl-detect.py --help` for the full flag set. Most-tuned flags:
131
 
132
  - `--prompt` / `--prompt-file` — the detection instruction
133
  - `--model` — any vLLM-supported VLM. Default: `Qwen/Qwen3.6-35B-A3B`. For smaller GPUs use `Qwen/Qwen3.5-9B` and lower `--max-model-len` / `--max-image-tokens`.
 
34
 
35
  ```bash
36
  hf jobs uv run \
37
+ --image vllm/vllm-openai:v0.32.0 \
38
  --flavor a100-large \
39
  --python /usr/bin/python3 \
40
  -e PYTHONPATH=/usr/local/lib/python3.12/dist-packages \
 
121
 
122
  ## Hardware notes
123
 
124
+ - **A100-large + `vllm/vllm-openai:v0.32.0` image** is the working combo. The default uv-script image installs PyPI's latest PyTorch, which has a CUDA driver mismatch on a100 hosts (driver 12.9, PyTorch wants newer). Workaround: `--image vllm/vllm-openai:v0.32.0 --python /usr/bin/python3 -e PYTHONPATH=/usr/local/lib/python3.12/dist-packages` (uses the image's pre-installed driver-compatible torch + vllm).
125
+ - **Local GPU runs**: the script headers leave `vllm`, `torch` and `transformers` to the Jobs image, so on your own Linux + CUDA machine add vLLM explicitly: `uv run --with vllm qwen3vl-detect.py …`.
126
  - **H200 was unreliable** in our testing — flashinfer's runtime JIT compile of cutlass kernels for `compute_90a` failed in the same image. Stick with A100 for now.
127
  - **`max_num_seqs` is auto-capped to `batch_size`**. Qwen3.6's hybrid Gated-DeltaNet architecture allocates per-sequence SSM cache blocks; vLLM's default 256 can exceed available blocks and crash CUDA graph capture. We never decode > batch_size concurrently anyway.
128
 
129
  ## CLI reference
130
 
131
+ Run `uv run qwen3vl-detect.py --help` for the full flag set (no GPU or vLLM needed). Most-tuned flags:
132
 
133
  - `--prompt` / `--prompt-file` — the detection instruction
134
  - `--model` — any vLLM-supported VLM. Default: `Qwen/Qwen3.6-35B-A3B`. For smaller GPUs use `Qwen/Qwen3.5-9B` and lower `--max-model-len` / `--max-image-tokens`.
qwen3vl-detect-fewshot.py CHANGED
@@ -5,13 +5,14 @@
5
  # "huggingface-hub",
6
  # "pillow",
7
  # "toolz",
8
- # "torch",
9
  # "tqdm",
10
- # "transformers",
11
- # "vllm>=0.15.1",
12
  # ]
13
  #
14
  # [tool.hf-jobs]
 
 
 
 
15
  # image = "vllm/vllm-openai:v0.32.0"
16
  # python = "/usr/bin/python3"
17
  # env = { PYTHONPATH = "/usr/local/lib/python3.12/dist-packages" }
@@ -59,14 +60,11 @@ import sys
59
  from datetime import datetime
60
  from typing import Any, Optional, Union
61
 
62
- import torch
63
  from datasets import load_dataset
64
  from huggingface_hub import login
65
  from PIL import Image
66
  from toolz import partition_all
67
  from tqdm.auto import tqdm
68
- from transformers import AutoProcessor
69
- from vllm import LLM, SamplingParams
70
 
71
  logging.basicConfig(
72
  level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s"
@@ -221,6 +219,12 @@ def main(
221
  seed: int = 42,
222
  create_pr: bool = False,
223
  ) -> None:
 
 
 
 
 
 
224
  if not torch.cuda.is_available():
225
  logger.error("CUDA is not available. This script requires a GPU.")
226
  logger.error("For cloud execution: hf jobs uv run --flavor a100-large ...")
@@ -456,13 +460,15 @@ def build_parser() -> argparse.ArgumentParser:
456
  formatter_class=argparse.RawDescriptionHelpFormatter,
457
  epilog="""
458
  Examples:
 
 
459
  # Generic detection
460
- uv run qwen3vl-detect.py \\
461
  input-dataset username/output-dataset \\
462
  --prompt "Detect all visible objects, return JSON with bbox_2d, label, sub_label"
463
 
464
  # Component detection (matches the demo's example 1)
465
- uv run qwen3vl-detect.py \\
466
  pcb-images username/labelled-pcbs \\
467
  --prompt-file prompts/components.txt \\
468
  --max-samples 20
 
5
  # "huggingface-hub",
6
  # "pillow",
7
  # "toolz",
 
8
  # "tqdm",
 
 
9
  # ]
10
  #
11
  # [tool.hf-jobs]
12
+ # # vllm, torch and transformers come from the image (PYTHONPATH). Listing them above makes uv
13
+ # # install a newer PyPI vllm and its deps; PYTHONPATH shadows that vllm but not new deps such
14
+ # # as b12x, which the image's vllm then imports and crashes on (missing flashinfer module).
15
+ # # Seen on v0.32.0 (2026-11-05); re-test before moving the tag. Local GPU: uv run --with vllm.
16
  # image = "vllm/vllm-openai:v0.32.0"
17
  # python = "/usr/bin/python3"
18
  # env = { PYTHONPATH = "/usr/local/lib/python3.12/dist-packages" }
 
60
  from datetime import datetime
61
  from typing import Any, Optional, Union
62
 
 
63
  from datasets import load_dataset
64
  from huggingface_hub import login
65
  from PIL import Image
66
  from toolz import partition_all
67
  from tqdm.auto import tqdm
 
 
68
 
69
  logging.basicConfig(
70
  level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s"
 
219
  seed: int = 42,
220
  create_pr: bool = False,
221
  ) -> None:
222
+ # Imported here rather than at module top so `uv run <script> --help` works without
223
+ # them; on Jobs they come from the vLLM image (see the header).
224
+ import torch
225
+ from transformers import AutoProcessor
226
+ from vllm import LLM, SamplingParams
227
+
228
  if not torch.cuda.is_available():
229
  logger.error("CUDA is not available. This script requires a GPU.")
230
  logger.error("For cloud execution: hf jobs uv run --flavor a100-large ...")
 
460
  formatter_class=argparse.RawDescriptionHelpFormatter,
461
  epilog="""
462
  Examples:
463
+ # Local GPU (Linux + CUDA): the header leaves vllm/torch/transformers to
464
+ # the Jobs image, so add vllm with --with.
465
  # Generic detection
466
+ uv run --with vllm qwen3vl-detect-fewshot.py \\
467
  input-dataset username/output-dataset \\
468
  --prompt "Detect all visible objects, return JSON with bbox_2d, label, sub_label"
469
 
470
  # Component detection (matches the demo's example 1)
471
+ uv run --with vllm qwen3vl-detect-fewshot.py \\
472
  pcb-images username/labelled-pcbs \\
473
  --prompt-file prompts/components.txt \\
474
  --max-samples 20
qwen3vl-detect.py CHANGED
@@ -5,13 +5,14 @@
5
  # "huggingface-hub",
6
  # "pillow",
7
  # "toolz",
8
- # "torch",
9
  # "tqdm",
10
- # "transformers",
11
- # "vllm>=0.15.1",
12
  # ]
13
  #
14
  # [tool.hf-jobs]
 
 
 
 
15
  # image = "vllm/vllm-openai:v0.32.0"
16
  # python = "/usr/bin/python3"
17
  # env = { PYTHONPATH = "/usr/local/lib/python3.12/dist-packages" }
@@ -53,14 +54,11 @@ import sys
53
  from datetime import datetime
54
  from typing import Any, Optional, Union
55
 
56
- import torch
57
  from datasets import load_dataset
58
  from huggingface_hub import login
59
  from PIL import Image
60
  from toolz import partition_all
61
  from tqdm.auto import tqdm
62
- from transformers import AutoProcessor
63
- from vllm import LLM, SamplingParams
64
 
65
  logging.basicConfig(
66
  level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s"
@@ -213,6 +211,12 @@ def main(
213
  seed: int = 42,
214
  create_pr: bool = False,
215
  ) -> None:
 
 
 
 
 
 
216
  if not torch.cuda.is_available():
217
  logger.error("CUDA is not available. This script requires a GPU.")
218
  logger.error("For cloud execution: hf jobs uv run --flavor a100-large ...")
@@ -407,13 +411,15 @@ def build_parser() -> argparse.ArgumentParser:
407
  formatter_class=argparse.RawDescriptionHelpFormatter,
408
  epilog="""
409
  Examples:
 
 
410
  # Generic detection
411
- uv run qwen3vl-detect.py \\
412
  input-dataset username/output-dataset \\
413
  --prompt "Detect all visible objects, return JSON with bbox_2d, label, sub_label"
414
 
415
  # Component detection (matches the demo's example 1)
416
- uv run qwen3vl-detect.py \\
417
  pcb-images username/labelled-pcbs \\
418
  --prompt-file prompts/components.txt \\
419
  --max-samples 20
 
5
  # "huggingface-hub",
6
  # "pillow",
7
  # "toolz",
 
8
  # "tqdm",
 
 
9
  # ]
10
  #
11
  # [tool.hf-jobs]
12
+ # # vllm, torch and transformers come from the image (PYTHONPATH). Listing them above makes uv
13
+ # # install a newer PyPI vllm and its deps; PYTHONPATH shadows that vllm but not new deps such
14
+ # # as b12x, which the image's vllm then imports and crashes on (missing flashinfer module).
15
+ # # Seen on v0.32.0 (2026-11-05); re-test before moving the tag. Local GPU: uv run --with vllm.
16
  # image = "vllm/vllm-openai:v0.32.0"
17
  # python = "/usr/bin/python3"
18
  # env = { PYTHONPATH = "/usr/local/lib/python3.12/dist-packages" }
 
54
  from datetime import datetime
55
  from typing import Any, Optional, Union
56
 
 
57
  from datasets import load_dataset
58
  from huggingface_hub import login
59
  from PIL import Image
60
  from toolz import partition_all
61
  from tqdm.auto import tqdm
 
 
62
 
63
  logging.basicConfig(
64
  level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s"
 
211
  seed: int = 42,
212
  create_pr: bool = False,
213
  ) -> None:
214
+ # Imported here rather than at module top so `uv run <script> --help` works without
215
+ # them; on Jobs they come from the vLLM image (see the header).
216
+ import torch
217
+ from transformers import AutoProcessor
218
+ from vllm import LLM, SamplingParams
219
+
220
  if not torch.cuda.is_available():
221
  logger.error("CUDA is not available. This script requires a GPU.")
222
  logger.error("For cloud execution: hf jobs uv run --flavor a100-large ...")
 
411
  formatter_class=argparse.RawDescriptionHelpFormatter,
412
  epilog="""
413
  Examples:
414
+ # Local GPU (Linux + CUDA): the header leaves vllm/torch/transformers to
415
+ # the Jobs image, so add vllm with --with.
416
  # Generic detection
417
+ uv run --with vllm qwen3vl-detect.py \\
418
  input-dataset username/output-dataset \\
419
  --prompt "Detect all visible objects, return JSON with bbox_2d, label, sub_label"
420
 
421
  # Component detection (matches the demo's example 1)
422
+ uv run --with vllm qwen3vl-detect.py \\
423
  pcb-images username/labelled-pcbs \\
424
  --prompt-file prompts/components.txt \\
425
  --max-samples 20