This commit is contained in:
Daniel Han 2025-03-14 05:57:17 -07:00
commit e6e071a456
2 changed files with 1 additions and 3 deletions

View file

@ -207,7 +207,7 @@ def grpo_trainer__get_per_token_logps(function_name, function):
if function_name != "_get_per_token_logps": return function
def _get_per_token_logps(self, model, input_ids, attention_mask, logits_to_keep):
if os.environ.get('UNSLOTH_USE_NEW_MODEL', '0') == '1':
if os.environ.get('UNSLOTH_USE_NEW_MODEL', '0') == '0':
return None # Unsloth efficient GRPO
# Otherwise, calculate normally:
if not hasattr(self, '_autocast_dtype'):

View file

@ -137,8 +137,6 @@ def unsloth_base_fast_generate(
try: kwargs["pixel_values"] = kwargs["pixel_values"].to(dtype)
except: pass
print(kwargs.keys())
# Mixed precision autocast
if os.environ.get("UNSLOTH_FORCE_FLOAT32", "0") == "1": dtype = torch.float32
with torch.inference_mode(), torch.autocast(device_type = "cuda", dtype = dtype):