Skip to content

Received a fatal error!! #16

Description

@znsoftm

test fewshot.py, get the below fatal error.

pytorch 1.10.0

for step, inputs in enumerate(train_dataloader):
            if use_cuda:
                inputs = inputs.cuda()
            logits = prompt_model(inputs)
            labels = inputs['label']
            loss = loss_func(logits, labels)
            loss.backward()  # it causes the fatal error.
            torch.nn.utils.clip_grad_norm_(prompt_model.parameters(), 1.0)
        
            tot_loss += loss.item()
            
            optimizer1.step()

one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [20, 1076]], which is output 0 of SoftmaxBackward0, is at version 1; expected version 0 instead. Hint: the backtrace further above shows the operation that failed to compute its gradient. The variable in question was changed in there or anywhere later. Good luck!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions