I need to finetune this from transformers import pipeline def classify_business(text):…
- User
I need to finetune this from transformers import pipeline
def classify_business(text): # Define the refined classification categories categories = [ "web development company", "mobile app development company", "enterprise software company", "hardware company", "fintech", "management consultancy", "marketing consultancy", "IT consultancy", "recruitment agency", "e-commerce", "retail", "banking", "insurance", ]
code# Create an instance of the zero-shot classification pipeline classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli") # Perform zero-shot classification result = classifier(text, categories) # Prepare the classification results as a dictionary output = {} for category, score in zip(result["labels"], result["scores"]): output[category] = score return output - Assistant
from transformers import pipeline
def classify_business(text): # Define the refined classification categories categories = [ "web development company", "mobile app development company", "enterprise software company", "hardware company", "fintech", "management consultancy", "marketing consultancy", "IT consultancy", "recruitment agency", "e-commerce", "retail", "banking", "insurance", ]
code# Create an instance of the zero-shot classification pipeline classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli") # Perform zero-shot classification result = classifier(text, categories) # Prepare the classification results as a dictionary output = {} for category, score in zip(result["labels"], result["scores"]): output[category] = score return output - User
I don't have training data yet, but I will want to add it at a later stage. What Can I do without training data ?
- Assistant
Without training data, you can still use the zero-shot classification approach, which is what the current function
classify_businessdoes. Zero-shot classification allows you to classify text into categories without any training data by leveraging a pre-trained language model's understanding of natural language. Thefacebook/bart-large-mnlimodel used in the function is a powerful pre-trained model that can perform this task.However, if you want to further improve the classification performance and adapt the model to your specific use case, you can consider the following steps without training data:
-
Data Collection: Start collecting and annotating data for your specific categories. This data will be used for fine-tuning the model in the future. You can use various sources like web scraping, APIs, or manual annotation to create a dataset.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.