From d8763da4a7ee3c39be0605499cb14b9dd137d540 Mon Sep 17 00:00:00 2001 From: digital-garbage <133010426+digital-garbage@users.noreply.github.com> Date: Sat, 30 May 2026 13:49:32 +0300 Subject: [PATCH] Fix UnboundLocalError: eff_key not yet assigned when VF loads Used refinement_key_input/refinement_key directly instead of eff_key which is assigned ~340 lines later in refine_v2. Co-Authored-By: Claude Sonnet 4.6 --- conditioning.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/conditioning.py b/conditioning.py index f8ada7db..4e4934f1 100644 --- a/conditioning.py +++ b/conditioning.py @@ -11539,13 +11539,14 @@ class FunPackVideoRefinerV2(FunPackVideoRefiner): # Load value function for conditioning memory modulation (confidence + gradient boost) _vf_for_memory = None - if not learning_mode and not prompt_only_mode and eff_key: + _eff_key_early = str(refinement_key_input or refinement_key or "").strip() + if not learning_mode and not prompt_only_mode and _eff_key_early: try: try: from .value_function import OnlineValueFunction as _OVF except ImportError: from value_function import OnlineValueFunction as _OVF - _vf_path = refinement_state_path(eff_key, "value_fn", prefix="refine_v2", extension="pt") + _vf_path = refinement_state_path(_eff_key_early, "value_fn", prefix="refine_v2", extension="pt") if os.path.exists(_vf_path): import torch as _torch with _torch.inference_mode(False):