Fine tuned multiclass model
Hello everyone,I’m working on a project where I need to create a fine-tuned model that can take a sentence as input and output scores for a group of labels. I have a labeled dataset with 10,000 records, but I’m unsure how to handle the label columns. Specifically, I need guidance on how to convert these labels into numerical format and which type of model would be suitable for this task.Any help or suggestions would be greatly appreciated. Thank you!
2023-11-09T12:39:03Z
Here is one approach. This just allocates a sequential number to each category.colab.research.google.comGoogle Colaboratory
2023-11-09T18:49:00Z
Thank you, that was really helpful! However, my dataset contains around 255 unique labels. Converting all of them to numerical values isn’t practical. How can I address this issue?i think it is zero shot classification task I’m not sure
2023-11-11T07:39:25Z
Why isn’t it practical to convert all of them to numerical values? If you don’t want to, you can use zero-shot classification like in the following link but the result may not be as good.https://huggingface.co/docs/transformers/v4.35.0/en/main_classes/pipelines#transformers.ZeroShotClassificationPipeline
2023-11-11T08:06:44Z
Thanks, I’ve converted the labels to numerical values. Now, I’m wondering if it’s possible to fine-tune a zero-shot classification model. If so, could you please share a link or guide me on how to do it? or i must use the pipeline directly without fine tune
2023-11-11T09:03:46Z
https://huggingface.co/docs/transformers/tasks/sequence_classificationYes, it is possible to finetune a zero-shot classification model as explained in the link above. It is also possible to use a pretrained model.
2023-11-11T09:05:44Z
https://discuss.huggingface.co/t/fine-tuning-zero-shot-models/15338The link above may be better.
2023-11-11T09:23:33Z
Thank you for the information. I believe the first link is for text classification, not specifically designed for zero-shot classification. Can you clarify if there’s any difference in fine tuned between the two? I want a zero-shotAlso, when fine-tuning a zero-shot classification model, what should the dataset format be? Should it be a labeled dataset with specific labels, or should it follow a specific structure, such as having two columns (premise and hypothesis) with labels like 1 (neutral), 0 (entailment), and 2 (contradiction)?
2023-11-11T09:48:45Z
https://discuss.huggingface.co/t/new-pipeline-for-zero-shot-text-classification/681/14#:~:text=Thanks%20for%20the,add%20a%20bit%3AThe link above describes the finetuning of zero-shot models. The difference between finetuning of sequences and NLI is that the former uses a custom number of labels and only the sequence to classify and the latter uses three labels in the specific order and the sequence to classify followed by the putative entailment as specified in the link above. That link also suggests to use zero-shot classification only if you don’t have enough labeled data.