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

"Encounter of RuntimeError at the Second Epoch in BERT Multiclass Text Classification" #1

Open
abhay-create opened this issue Apr 3, 2024 · 0 comments

Comments

@abhay-create
Copy link

abhay-create commented Apr 3, 2024

@Vidhi1290 I just want to thank you for sharing your work with us. while training the model i encountered following error.
/usr/local/lib/python3.10/dist-packages/torch/nn/functional.py in cross_entropy(input, target, weight, size_average, ignore_index, reduce, reduction, label_smoothing)
3057 if size_average is not None or reduce is not None:
3058 reduction = _Reduction.legacy_get_string(size_average, reduce)
-> 3059 return torch._C._nn.cross_entropy_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index, label_smoothing)

RuntimeError: size mismatch (got input: [6], target: [1])
This error occurred during the second epoch, at approximately 96% completion. It's worth noting that initially, the model was successfully trained for 1 epoch on the CPU without any issues.

Changes Made Before Using the Model
Before training the model, I made changes to some variables at the top of the notebook according to my requirements. These changes included adjusting variables such as label_col, tokens_path, and labels_path. No other modifications were made to the code or the model architecture.

Data Information
My data is structured in a CSV file with two columns: one for the text of the questions and another for the associated labels (levels 1-6). There are a total of 6 classes in the classification, with each text question associated with a specific level in the next column.

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