Create README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,73 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
library_name: transformers
|
6 |
+
pipeline_tag: text-classification
|
7 |
---
|
8 |
+
# Distil BERT Base Uncased Text Classification Model
|
9 |
+
|
10 |
+
This repository contains a Distil BERT Base Uncased model that has been fine-tuned for a custom text classification use case. The model is designed to classify text into nine different classes based on the following categories:
|
11 |
+
|
12 |
+
1. **Neutral**: This class is for any other sort of sentences that do not fall into the specific categories below.
|
13 |
+
|
14 |
+
2. **Play**: Use this class to classify the intent of the user to listen to music or audio.
|
15 |
+
|
16 |
+
3. **Visit**: This class is intended for classifying the user's intent to visit or open a website in a web browser.
|
17 |
+
|
18 |
+
4. **ImgReco**: Use this class to make the bot process an image for image-to-text conversion or any image recognition tasks.
|
19 |
+
|
20 |
+
5. **Close**: For classifying sentences that indicate the user's intent to close a specific application or software.
|
21 |
+
|
22 |
+
6. **Web Search**: This class is designed to identify the user's intent to search the internet for information.
|
23 |
+
|
24 |
+
7. **Open**: Use this class for classifying the intent of opening a specific app or software.
|
25 |
+
|
26 |
+
8. **ImgGen**: This class is for sentences related to text-to-image processing or image generation tasks.
|
27 |
+
|
28 |
+
9. **Math**: Classify sentences that include mathematical equations or expressions using this category.
|
29 |
+
|
30 |
+
## Model Details
|
31 |
+
|
32 |
+
- **Model Architecture**: Distil BERT Base Uncased
|
33 |
+
- **Number of Classes**: 9
|
34 |
+
- **Training Data**: The model was trained on a custom dataset for text classification tasks related to the mentioned categories.
|
35 |
+
|
36 |
+
## Usage
|
37 |
+
|
38 |
+
You can use this fine-tuned Distil BERT model for text classification in your own applications or projects. Here's a simple example of how to use the model in Python:
|
39 |
+
|
40 |
+
```python
|
41 |
+
from transformers import DistilBertTokenizer, DistilBertForSequenceClassification
|
42 |
+
import torch
|
43 |
+
|
44 |
+
# Load the pre-trained model and tokenizer
|
45 |
+
tokenizer = DistilBertTokenizer.from_pretrained("distilbert-base-uncased")
|
46 |
+
model = DistilBertForSequenceClassification.from_pretrained("your_model_directory_path")
|
47 |
+
|
48 |
+
# Prepare the input text
|
49 |
+
text = "Your input text goes here."
|
50 |
+
|
51 |
+
# Tokenize the text and classify it
|
52 |
+
input_ids = tokenizer.encode(text, truncation=True, padding=True, return_tensors="pt")
|
53 |
+
output = model(input_ids)
|
54 |
+
logits = output.logits
|
55 |
+
probabilities = logits.softmax(dim=1)
|
56 |
+
|
57 |
+
# Get the class with the highest probability
|
58 |
+
predicted_class = torch.argmax(probabilities)
|
59 |
+
|
60 |
+
# The predicted_class variable will contain the predicted class index.
|
61 |
+
```
|
62 |
+
|
63 |
+
Remember to replace `"your_model_directory_path"` with the actual path to the fine-tuned model on your system.
|
64 |
+
|
65 |
+
## Training
|
66 |
+
|
67 |
+
To fine-tune this model for your own custom use case, you can use the Hugging Face Transformers library along with your custom dataset. Refer to the [Hugging Face Transformers documentation](https://huggingface.co/transformers/main_classes/configuration.html) for more details on training and fine-tuning.
|
68 |
+
|
69 |
+
## License
|
70 |
+
|
71 |
+
Please refer to the licenses associated with the Distil BERT Base Uncased model and any other relevant libraries or datasets you used during fine-tuning.
|
72 |
+
|
73 |
+
If you have any questions or need further assistance, please feel free to reach out.
|