interpretml/interpret-text

Got an error when running the Rationale Explainer Sample Notebook (with `fixed_classifier` = False)

ceshine opened this issue · 0 comments

When trying to run the Introspective Rationale Explainer Sample Notebook (after going around #150 by using specifying CUDA=True), this error came up:

RuntimeError: one of the variables needed for gradient computation has been modified by an in-place operation: [torch.FloatTensor [50, 150]], which is output 0 of TBackward, is at version 9; expected version 8 instead.

This time the problem seems to be from training the classifier used to feed label to the generator (specifically, this block of code). The notebook can run to the end after commenting out this block (line 232 to 235).

(Update: an alternative workaround is to set fixed_classifier=True and pretrain_cls=True in model_config. This should pre-train the classifier and freeze the classifier weights during generator training.)

(I used PyTorch 1.7 to run the notebook.)