|
14 | 14 | build_ctc_asr_workflow_metadata, |
15 | 15 | ) |
16 | 16 | from mobius.models.wav2vec2_ctc import Wav2Vec2ForCTCModel |
17 | | -from mobius.tasks._ctc_asr import BATCH_PADDING_SENSITIVE_KEY, CTCAsrTask |
| 17 | +from mobius.tasks._ctc_asr import CTCAsrTask |
18 | 18 |
|
19 | 19 |
|
20 | 20 | def _tiny_config(**overrides) -> MMSConfig: |
@@ -69,21 +69,7 @@ def test_rejects_unknown_feature_normalization(self): |
69 | 69 | _tiny_config(feat_extract_norm="batch") |
70 | 70 |
|
71 | 71 |
|
72 | | -class TestBatchPaddingSensitivity: |
73 | | - """Padding sensitivity is a property of the feature normalization.""" |
74 | | - |
75 | | - def test_group_normalization_is_padding_sensitive(self): |
76 | | - module = Wav2Vec2ForCTCModel(_tiny_config(feat_extract_norm="group")) |
77 | | - assert module.batch_padding_sensitive is True |
78 | | - |
79 | | - def test_layer_normalization_is_row_independent(self): |
80 | | - module = Wav2Vec2ForCTCModel(_tiny_config(feat_extract_norm="layer")) |
81 | | - assert module.batch_padding_sensitive is False |
82 | | - |
83 | | - def test_task_records_sensitivity_on_the_built_graph(self): |
84 | | - pkg = _build(_tiny_config(feat_extract_norm="group")) |
85 | | - assert pkg["model"].metadata_props[BATCH_PADDING_SENSITIVE_KEY] == "true" |
86 | | - |
| 72 | +class TestArchitectureRouting: |
87 | 73 | def test_config_class_survives_architecture_rerouting(self): |
88 | 74 | # Config resolution reaches this module by re-routing model_type |
89 | 75 | # "wav2vec2" to the "mms" registration, so the module must name its own |
@@ -120,16 +106,21 @@ def test_transcription_profile_carries_a_ctc_decoding_contract(self, metadata): |
120 | 106 | assert decoding["collapse_repeats"] is True |
121 | 107 | assert (decoding["time_axis"], decoding["class_axis"]) == (1, 2) |
122 | 108 |
|
123 | | - def test_padding_sensitive_profile_binds_per_row_lengths(self, metadata): |
| 109 | + def test_frame_lengths_bind_the_ctc_decode(self, metadata): |
124 | 110 | profile = metadata["profiles"]["transcription"] |
125 | | - assert profile["batch_invariance"] == "padding_sensitive" |
126 | 111 | assert profile["decoding"]["lengths"] == "frame_lengths" |
127 | 112 | assert profile["outputs"]["frame_lengths"] == "frame_lengths" |
128 | 113 |
|
129 | | - def test_row_independent_when_feature_norm_is_layer(self): |
130 | | - config = _tiny_config(feat_extract_norm="layer") |
| 114 | + @pytest.mark.parametrize("normalization", ["group", "layer"]) |
| 115 | + def test_batch_permission_is_never_inferred_from_shape_or_normalization( |
| 116 | + self, normalization |
| 117 | + ): |
| 118 | + config = _tiny_config(feat_extract_norm=normalization) |
131 | 119 | metadata = build_ctc_asr_workflow_metadata(_build(config), config) |
132 | | - assert metadata["profiles"]["transcription"]["batch_invariance"] == ("row_independent") |
| 120 | + profile = metadata["profiles"]["transcription"] |
| 121 | + component = metadata["pipeline"]["workflow"]["components"]["encoder"] |
| 122 | + assert "batch_invariance" not in profile |
| 123 | + assert "batch_capacity" not in component |
133 | 124 |
|
134 | 125 | def test_workflow_is_a_plain_sequence_with_no_generation_loop(self, metadata): |
135 | 126 | steps = metadata["pipeline"]["workflow"]["steps"] |
|
0 commit comments