Skip to content

Expected object of scalar type Bool but got scalar type Byte for argument #2 'other' #73

@fx7056

Description

@fx7056

How to fix the problem
02/18/2022 14:31:08 - INFO - root - initializing callbacks
02/18/2022 14:31:08 - INFO - root - ***** Running training *****
02/18/2022 14:31:08 - INFO - root - Num examples = 127657
02/18/2022 14:31:08 - INFO - root - Num Epochs = 6
02/18/2022 14:31:08 - INFO - root - Total train batch size (w. parallel, distributed & accumulation) = 8
02/18/2022 14:31:08 - INFO - root - Gradient Accumulation steps = 1
02/18/2022 14:31:08 - INFO - root - Total optimization steps = 95748
02/18/2022 14:31:08 - WARNING - root - Warning: There's no GPU available on this machine, training will be performed on CPU.
02/18/2022 14:31:08 - WARNING - root - Warning: The number of GPU's configured to use is 0, but only 0 are available on this machine.
02/18/2022 14:31:08 - INFO - root - Epoch 1/6
Traceback (most recent call last):
File "run_bert.py", line 216, in
main()
File "run_bert.py", line 209, in main
run_train(args)
File "run_bert.py", line 117, in run_train
trainer.train(train_data=train_dataloader, valid_data=valid_dataloader)
File "/mnt/c/Users/admin/Downloads/Bert-Multi-Label-Text-Classification-master/pybert/train/trainer.py", line 153, in train
train_log = self.train_epoch(train_data)
File "/mnt/c/Users/admin/Downloads/Bert-Multi-Label-Text-Classification-master/pybert/train/trainer.py", line 118, in train_epoch
self.info[metric.name()] = metric.value()
File "/mnt/c/Users/admin/Downloads/Bert-Multi-Label-Text-Classification-master/pybert/train/metrics.py", line 90, in value
acc = np.mean(((self.y_pred>self.thresh)==self.y_true.byte()).float().cpu().numpy(), axis=1).sum()
RuntimeError: Expected object of scalar type Bool but got scalar type Byte for argument #2 'other'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions