Closed zippeurfou closed 3 years ago
same here~
$ python train.py task=nlp/text_classification dataset=nlp/text_classification/emotion
...
torch.nn.modules.module.ModuleAttributeError: 'TextClassificationTransformer' object has no attribute 'num_classes'
Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.
Thanks guys! This makes sense, I think the right approach to fix this would be to either infer the number of classes from the data (by collecting all unique labels, which I think HF Datasets supports) or to allow the user to pass this in.
this error only for cli when u fixed this, or how I can do this myself?
but, when run predict
accept next error
am running into the same issue, is there any workarounds? ''' TextClassificationTransformer' object has no attribute 'num_classes' '''
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
🐛 Bug
When training a classification model on custom data file, the training fails because it expect
num_classes
To Reproduce
Use this collab: https://colab.research.google.com/drive/1uamw6SNaOr_4ch24JNxAj2yfgLUKfJqO?usp=sharing Error:
Expected behavior
It should start training.
Environment
check the notebook