You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This kind of silent failure can make nnsight very hard to debug:
importtorchasthfromnnsightimportLanguageModelnn_model=LanguageModel("gpt2", device_map="cpu")
# The patching fails silently because hidden is not setwithnn_model.trace("a"):
hidden=nn_model.transformer.h[0].outputwithnn_model.trace("b"):
nn_model.transformer.h[0].output=hiddencorrupted_logits=nn_model.lm_head.output.save()
# The patching will workwithnn_model.trace("a"):
hidden=nn_model.transformer.h[0].output.save()
withnn_model.trace("b"):
nn_model.transformer.h[0].output=hiddencorrupted_logits2=nn_model.lm_head.output.save()
# The patching will fail silently because h[10].output has not been computed when h[0] is computedwithnn_model.trace("b"):
nn_model.transformer.h[0].output=nn_model.transformer.h[10].outputcorrupted_logits3=nn_model.lm_head.output.save()
withnn_model.trace("b"):
clean_logits=nn_model.lm_head.output.save()
assertnotth.allclose(clean_logits, corrupted_logits2), "this assert pass"assertnotth.allclose(clean_logits, corrupted_logits3), "this assert fails"assertnotth.allclose(clean_logits, corrupted_logits), "this assert fails"
The text was updated successfully, but these errors were encountered:
This kind of silent failure can make nnsight very hard to debug:
The text was updated successfully, but these errors were encountered: