File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -602,11 +602,14 @@ def mono_quantize(
602602 if is_nemotron_parse :
603603 # For Nemotron-Parse, wrap the model to force use_cache=False
604604 print ("Wrapping Nemotron-Parse model for calibration (use_cache=False)" )
605- original_forward = language_model .forward
605+ # Store original forward before wrapping
606+ _original_forward = language_model .forward
607+ original_forward = _original_forward # Capture in outer scope
606608
607609 def wrapped_forward (* args , ** kwargs ):
608610 kwargs ["use_cache" ] = False
609- return original_forward (* args , ** kwargs )
611+ # Call the captured forward method
612+ return _original_forward (* args , ** kwargs )
610613
611614 # Temporarily replace forward method
612615 language_model .forward = wrapped_forward
You can’t perform that action at this time.
0 commit comments