Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
fx7056 opened this issue Feb 18, 2022 · 0 comments

Comments

@fx7056
Copy link

fx7056 commented Feb 18, 2022

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'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant