@@ -281,3 +281,29 @@ def test_registered_config_builds(name, patch, seq_len):
281281 assert model .visual .trunk .get_patch_size () == (patch , patch )
282282 assert not isinstance (model .visual .trunk .norm_pre , torch .nn .Identity )
283283 assert model .visual .output_tokens
284+
285+
286+ # ---------------------------------------------------------------- task integration extras
287+
288+ def test_blocks_discovery_includes_timm_trunk ():
289+ """The FSDP/blocks-compile discovery must cover the timm vision trunk, not just the text
290+ stacks -- otherwise --torchcompile-strategy blocks leaves the whole vision tower eager."""
291+ model = _tiny_model ().train ()
292+ task = CoCaTask (model , verbose = False )
293+ names = [n for n , _ in task ._get_fsdp_shard_modules ()]
294+ trunk = [n for n in names if n .startswith ('visual.trunk.blocks' )]
295+ assert len (trunk ) == TINY_VISION_CFG ['timm_model_kwargs' ]['depth' ], \
296+ f'timm trunk blocks not discovered: { names } '
297+
298+
299+ def test_mammut_pass_graph_break_eager_noop ():
300+ """pass_graph_break must be a pure compile-time hint: eager outputs identical either way."""
301+ model = _tiny_model ()
302+ batch , text = _patch_batch (), _text_batch ()
303+ with torch .no_grad ():
304+ base = model (image = batch , text = text )
305+ model .pass_graph_break = True
306+ split = model (image = batch , text = text )
307+ for k , v in base .items ():
308+ if torch .is_tensor (v ):
309+ torch .testing .assert_close (v , split [k ], rtol = 0 , atol = 0 )
0 commit comments