diff --git a/samplers.py b/samplers.py index 8c6494da..23358c8d 100644 --- a/samplers.py +++ b/samplers.py @@ -4894,6 +4894,14 @@ class FunPackLTXAVSceneChainSampler: grad = value_fn.gradient(source) unit = torch.nn.functional.normalize(grad.float(), dim=-1) vf_state["d"] = self._direction_in_cond_space(model, raw_cond, unit, cond) + if vf_state["d"] is not None: + # Say so out loud: the fixed-direction fallback announces itself when it + # lifts, so silence here reads as "nothing happened" rather than success. + lifted = int(vf_state["d"].shape[-1]) != int(unit.shape[-1]) + print("[FunPackSceneChain] embed_guidance: steering on the value function " + "gradient" + (f", lifted {int(unit.shape[-1])} -> " + f"{int(vf_state['d'].shape[-1])} through the model's own " + "text preprocessor" if lifted else "")) if vf_state["d"] is None: print("[FunPackSceneChain] embed_guidance: the value function gradient " "cannot be mapped onto this model's conditioning, using fixed direction") diff --git a/tests/test_minimax_h3_sampler.py b/tests/test_minimax_h3_sampler.py index ccaf2621..f74d6116 100644 --- a/tests/test_minimax_h3_sampler.py +++ b/tests/test_minimax_h3_sampler.py @@ -884,3 +884,11 @@ def test_an_unusable_value_function_falls_back_to_the_fixed_direction(capsys): out = capsys.readouterr().out assert out.count("value function gradient failed") == 1 # once per run, not per step assert not torch.equal(seen["cond"], cond) # fixed direction still steers + + +def test_a_working_value_function_says_so_instead_of_steering_silently(capsys): + _run_embed_wrapper_with_vf(_h3ish_model(), torch.randn(1, 12, TEXT_DIM), + torch.randn(1, 12, HIDDEN), _RawSpaceValueFunction(), steps=4) + out = capsys.readouterr().out + assert out.count("steering on the value function gradient") == 1 + assert "5120 -> 5376" in out