foamliu / Sentiment-Analysis

细粒度用户评论情感分析
Apache License 2.0
116 stars 24 forks source link

Hello, please ask me about running through your code With my own dataset, the dataset format is the same, that is, you need to change the num_classes in the config.py to 3 num_labels to 12, but why does it fail? It belongs to multi-label sentiment analysis #6

Open taozixiangpichipeach opened 1 year ago

taozixiangpichipeach commented 1 year ago

Hello, please ask me about running through your code With my own dataset, the dataset format is the same, that is, you need to change the num_classes in the config.py to 3 num_labels to 12, but why does it fail? It belongs to multi-label sentiment analysis The following are the error messages

[2023-07-24 22:30:44] Epoch: [0][420/846] Batch Time 0.062 (0.076) Loss 0.6371 (0.6336) Accuracy 83.333 (77.189) C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\cuda\Loss.cu:242: block: [0,0,0], thread: [0,0,0] Assertion t >= 0 && t < n_classes failed. Traceback (most recent call last): File "C:\Users\Admin\Desktop\tlt\Sentiment-Analysis-master\train.py", line 194, in main() File "C:\Users\Admin\Desktop\tlt\Sentiment-Analysis-master\train.py", line 167, in main train(epoch, train_data, encoder, optimizer) File "C:\Users\Admin\Desktop\tlt\Sentiment-Analysis-master\train.py", line 55, in train acc += accuracy(outputs[:, :, idx], target_variable[:, idx]) / len(label_names) File "C:\Users\Admin\Desktop\tlt\Sentiment-Analysis-master\utils.py", line 105, in accuracy return correct_total.item() * (100.0 / batch_size) RuntimeError: CUDA error: device-side assert triggered [W CUDAGuardImpl.h:46] Warning: CUDA warning: driver shutting down (function uncheckedGetDevice) [W CUDAGuardImpl.h:62] Warning: CUDA warning: driver shutting down (function uncheckedSetDevice)