This commit is contained in:
Daniel Han 2024-11-25 22:12:22 -08:00
commit 11e8e19071
2 changed files with 5 additions and 7 deletions

View file

@ -1175,7 +1175,7 @@ LOGITS_ERROR_STRING = \
"os.environ['UNSLOTH_RETURN_LOGITS'] = '1'\n"\
"... trainer.train() ..."
def raise_logits_error(*args, **kwargs): raise NotImplementedError(LOGITS_ERROR_STRING)
def raise_logits_error(*args, **kwargs): print(LOGITS_ERROR_STRING)
class EmptyLogits:
def __init__(self): return
__getitem__ = raise_logits_error
@ -1185,7 +1185,7 @@ class EmptyLogits:
pass
EMPTY_LOGITS = EmptyLogits()
functions = dir(torch.Tensor)
# for function in functions:
# try: exec(f"EMPTY_LOGITS.{function} = raise_logits_error", globals(), locals())
# except: continue
# pass
for function in functions:
try: exec(f"EMPTY_LOGITS.{function} = raise_logits_error", globals(), locals())
except: continue
pass

View file

@ -1001,8 +1001,6 @@ def CausalLM_fast_forward(fast_forward_inference):
hidden_states=outputs.hidden_states,
attentions=outputs.attentions,
)
print(output)
print(output)
return output
pass
logits = self.lm_head(hidden_states.to(lm_head.dtype))