Commit 1f8daee
authored
tests: reduce processor test memory usage by using tiny Hub checkpoints (#47213)
* tests/kimi_k25: add tiny_model_id to speed up processor tests
Use hf-internal-testing/tiny-processor-kimi_k25 (75KB tokenizer vs 19MB full)
so most tests load the tiny processor instead of the full one.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* tests/llama4: add tiny_model_id, remove _setup_tokenizer hook
Use hf-internal-testing/tiny-processor-llama4 (500 vocab vs 200k) so
tests load the tiny processor instead of the full one.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* tests/deepseek_ocr2,got_ocr2: add tiny_model_id, remove _setup_tokenizer
- deepseek_ocr2: tiny-processor-deepseek_ocr2 (500 vocab vs 102k)
- got_ocr2: tiny-processor-got_ocr2 (500 vocab vs 32k); add
_setup_image_processor() to preserve default 384x384 size; update
test_ocr_queries expected input_ids shapes for tiny tokenizer
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix
* Add analyze_mem.py and memory_tracker_plugin from debug_mem
Brings memory profiling tooling into fix_slow_processor branch:
- analyze_mem.py: runs processor tests and aggregates memory usage
- memory_tracker_plugin.py: pytest plugin for per-test memory tracking
- conftest.py: integrate memory tracker plugin
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Fix processor test failures for florence2, granite4_vision, pp_chart2table
- florence2: skip 6 tests that check max_length/padding; processor always
produces ~585 tokens (256 image tokens + task prompt) and does not forward
tokenizer padding kwargs
- granite4_vision: add _setup_image_processor with LlavaNextImageProcessor
(returns required image_sizes key); add num_additional_image_tokens=1 to
prepare_processor_dict to match tiny repo config
- pp_chart2table: skip test_model_input_names (image processor declares
original_image_size in model_input_names but does not return it); fix
test_ocr_queries token count assertion 325→324
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Fix granite4_vision test_image_token_filling expected token count
num_additional_image_tokens=1 adds 1 to base features: 405 - 1 (CLS) = 404.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Fix Florence2 processor tests: use image_seq_length=2 instead of skipping
Add _setup_image_processor hook that loads image processor from tiny repo
but sets image_seq_length=2, keeping output sequences short enough for
the standard max_length/padding tests to pass.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* tests/pp_chart2table: fix test_model_input_names instead of skipping
Add _setup_image_processor returning PPChart2TableImageProcessor() (default,
model_input_names=['pixel_values']) so the Hub config's extra 'original_image_size'
entry doesn't cause the assertion to fail.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* tests/kimi_k25: use tiny_video_320x240.mp4 instead of 4K source video
The previous video (raushan-testing-hf/tiny_video.mp4) was 3840x2160 (4K),
causing ~150 MB of memory just to decode frames before resizing to 28x28.
Switch to hf-internal-testing/test-videos/tiny_video_320x240.mp4 (320x240,
same 11 frames) which is 144x cheaper to decode.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* tests: reduce memory in deepseek_ocr2 and audioflamingo3 processor tests
- deepseek_ocr2: use (769,577) image instead of (3264,2448) — same 2×3 tiling
grid (ar≈0.75 matches 2×3 canvas best), same 1121 token count, 18× smaller tensor
- audioflamingo3: use tiny processor + small public audio fixture instead of
full nvidia/audio-flamingo-3-hf model + nvidia/AudioSkills wav in
test_apply_transcription_request_single
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* tests: eliminate full-model downloads in audioflamingo3 processor tests
Replace self.checkpoint (nvidia/audio-flamingo-3-hf) with tiny_model_id in
test_can_load_various_tokenizers, test_save_load_pretrained_default,
test_tokenizer_integration, and test_chat_template. For tokenizer_integration,
drop hardcoded golden tokens and just assert slow==fast parity.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* tests: fix kimi_k25 slow setup and stale video assertions
- Remove model_id (RaushanTurganbay/kimi2.7-processor): no test calls
get_processor(use_tiny_ckpt=False), so the full-model download in setUpClass
was purely wasted time
- Replace hardcoded pixel_values_videos length assertions (written for 4K video)
with video_grid_thw-based checks; also verify num_frames vs fps give different
token counts
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* tests: reduce memory in sam3, qwen3_asr, vibevoice_asr processor tests
- sam3: add _setup_image_processor reducing default size from 1008×1008 to 64×64
(mask_size 288×288 → 16×16); default sizes allocate ~100 MB of tensors
- qwen3_asr: replace self.checkpoint (Qwen/Qwen3-ASR-0.6B-hf) with tiny_model_id
in test_can_load_various_tokenizers, test_save_load_pretrained_default, and
get_processor() in test_chat_template, test_apply_transcription_request_with_language,
test_decode_formats; use small public audio fixture instead of bezzam dataset
- vibevoice_asr: same pattern — tiny_model_id for load tests, get_processor() for
transcription/decode tests, replace bezzam wav with small public audio fixture
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* tests: eliminate full-model downloads in musicflamingo processor tests
Replace self.checkpoint (nvidia/music-flamingo-2601-hf) with tiny_model_id in
test_can_load_various_tokenizers, test_save_load_pretrained_default; use
get_processor() in test_chat_template and test_transcription_helpers_not_supported;
simplify test_tokenizer_integration to slow==fast parity check with tiny tokenizer.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(glmasr): use tiny_model_id in test_can_load_various_tokenizers and test_save_load_pretrained_default
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(vibevoice_asr): mock batch_decode in test_decode_output_formats to avoid tiny tokenizer vocab mismatch
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* docs(vibevoice_asr): add comment explaining mock in test_decode_output_formats
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(vibevoice_asr): use real decoded string in test_decode_output_formats mock
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* docs(vibevoice_asr): clarify mock comment in test_decode_output_formats
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(vibevoice_asr): mock tokenizer.decode to avoid tiny-tokenizer JSON parse failure
test_decode_output_formats hardcoded Qwen token IDs that the tiny tokenizer
decodes to garbage, breaking json.loads(). Mock tokenizer.decode with the
real decoded string from the full processor (microsoft/VibeVoice-ASR-HF)
prior to PR #47213, which is what this test was always validating.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* ci: trigger processor tests via test_processing_common.py touch
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* ci: restrict test fetcher to processor tests only for this PR
Temporarily limit JOB_TO_TEST_FILE to tests_processors so CI only
runs processor tests, avoiding unrelated modeling/tokenization jobs.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* format
* format
* fix(ovis2): add _setup_image_processor and image_token to prepare_processor_dict
- max_patches=1 ensures each image produces exactly 1 tile so
len(pixel_values)==batch_size as _test_apply_chat_template expects
- image_token='<IMG_ATOM>' in prepare_processor_dict prevents mismatch
in test_processor_from_pretrained_vs_from_components when the tokenizer
lacks an image_token attribute (defaults to '<image>' without the kwarg)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* revert(qwen3_asr): restore original test until checkpoints are updated
Eric will update the Qwen3 ASR checkpoints; the tiny-processor-qwen3_asr
switch will be re-applied once the new checkpoint is available.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* revert: remove analyze_mem, memory_tracker_plugin, conftest changes
These memory profiling tools are not part of the processor test speed-up
scope for PR #47213.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* revert: restore tests_fetcher.py and test_processing_common.py to main
Both were temporary CI-triggering changes not meant for the PR.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* test: add @slow test_tokenizer_full_integration for audioflamingo3 and musicflamingo
Preserves the original golden-token assertions (EXPECTED_OUTPUT) against the
full Hub checkpoints as a slow test, while the fast test_tokenizer_integration
uses the tiny repo for a quick slow/fast parity check.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fixup: use self.checkpoint in test_tokenizer_full_integration
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* processor tests: add source comments, remove unused checkpoints, document setup hooks
- Add `# Tiny processor created with make_tiny_processor.py from "<repo>"` comment
on every `tiny_model_id` class attribute (14 files)
- Remove unused `checkpoint = ...` class attributes from glmasr and vibevoice_asr
(neither file ever references `self.checkpoint`)
- Add explanatory comments on all `_setup_image_processor` / `_setup_video_processor`
hooks that lacked them, explaining why each custom setup is needed
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>1 parent d47a534 commit 1f8daee
21 files changed
Lines changed: 217 additions & 151 deletions
File tree
- tests/models
- audioflamingo3
- colpali
- deepseek_ocr2
- florence2
- glmasr
- got_ocr2
- granite4_vision
- kimi_k25
- lfm2_vl
- llama4
- llava_next
- musicflamingo
- omdet_turbo
- ovis2
- paligemma
- phi4_multimodal
- pi0
- pp_chart2table
- sam3
- shieldgemma2
- vibevoice_asr
Lines changed: 29 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
38 | 41 | | |
39 | | - | |
40 | 42 | | |
41 | | - | |
42 | | - | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
63 | | - | |
64 | | - | |
| 64 | + | |
| 65 | + | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
69 | | - | |
70 | | - | |
| 70 | + | |
| 71 | + | |
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
| |||
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
85 | 101 | | |
86 | 102 | | |
87 | 103 | | |
| |||
118 | 134 | | |
119 | 135 | | |
120 | 136 | | |
121 | | - | |
| 137 | + | |
122 | 138 | | |
123 | 139 | | |
124 | 140 | | |
| |||
146 | 162 | | |
147 | 163 | | |
148 | 164 | | |
149 | | - | |
| 165 | + | |
150 | 166 | | |
151 | | - | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
152 | 170 | | |
153 | 171 | | |
154 | 172 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
85 | 86 | | |
86 | 87 | | |
87 | 88 | | |
88 | | - | |
| 89 | + | |
89 | 90 | | |
90 | 91 | | |
91 | 92 | | |
| |||
Lines changed: 6 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| 33 | + | |
| 34 | + | |
31 | 35 | | |
32 | 36 | | |
33 | 37 | | |
34 | 38 | | |
35 | 39 | | |
36 | 40 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | 41 | | |
44 | 42 | | |
45 | 43 | | |
| |||
73 | 71 | | |
74 | 72 | | |
75 | 73 | | |
76 | | - | |
77 | | - | |
| 74 | + | |
| 75 | + | |
78 | 76 | | |
79 | 77 | | |
80 | 78 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
36 | 41 | | |
37 | | - | |
| 42 | + | |
38 | 43 | | |
39 | 44 | | |
40 | 45 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | 46 | | |
50 | 47 | | |
51 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
38 | | - | |
39 | 40 | | |
40 | | - | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | | - | |
| 62 | + | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
69 | | - | |
| 68 | + | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
| |||
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
41 | | - | |
| 43 | + | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
45 | | - | |
| 47 | + | |
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
49 | | - | |
| 51 | + | |
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
53 | | - | |
| 55 | + | |
54 | 56 | | |
55 | 57 | | |
56 | 58 | | |
57 | | - | |
| 59 | + | |
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
61 | | - | |
| 63 | + | |
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
| |||
Lines changed: 18 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
44 | 47 | | |
45 | 48 | | |
46 | 49 | | |
| |||
52 | 55 | | |
53 | 56 | | |
54 | 57 | | |
| 58 | + | |
55 | 59 | | |
56 | 60 | | |
57 | 61 | | |
| |||
97 | 101 | | |
98 | 102 | | |
99 | 103 | | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
104 | 108 | | |
105 | 109 | | |
106 | 110 | | |
| |||
0 commit comments