Update README.md
Browse files
README.md
CHANGED
|
@@ -26,17 +26,17 @@ This fine-tuned BERT model is a multilabel multiclass classifier designed to pre
|
|
| 26 |
|
| 27 |
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
|
| 28 |
|
| 29 |
-
- **Developed by:**
|
| 30 |
-
- **Model type:**
|
| 31 |
-
- **Language(s) (NLP):**
|
| 32 |
-
- **License:**
|
| 33 |
-
- **Finetuned from model
|
| 34 |
|
| 35 |
### Model Sources [optional]
|
| 36 |
|
| 37 |
<!-- Provide the basic links for the model. -->
|
| 38 |
|
| 39 |
-
- **Repository:**
|
| 40 |
|
| 41 |
## Uses
|
| 42 |
|
|
@@ -62,69 +62,51 @@ This BERT-based multilabel multiclass classifier is designed to predict the genr
|
|
| 62 |
- **Content Creators:** Gaining better visibility through accurate classification and tagging of their work.
|
| 63 |
- **Platform Operators:** Improving user engagement and satisfaction with more personalized and accurate content delivery.
|
| 64 |
|
|
|
|
| 65 |
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
| 69 |
-
|
| 70 |
-
[More Information Needed]
|
| 71 |
-
|
| 72 |
-
### Downstream Use [optional]
|
| 73 |
-
|
| 74 |
-
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
| 75 |
-
|
| 76 |
-
[More Information Needed]
|
| 77 |
-
|
| 78 |
-
### Out-of-Scope Use
|
| 79 |
-
|
| 80 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
| 81 |
-
|
| 82 |
-
[More Information Needed]
|
| 83 |
-
|
| 84 |
-
## Bias, Risks, and Limitations
|
| 85 |
-
|
| 86 |
-
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
| 87 |
-
|
| 88 |
-
[More Information Needed]
|
| 89 |
-
|
| 90 |
-
### Recommendations
|
| 91 |
-
|
| 92 |
-
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
| 93 |
|
| 94 |
-
|
| 95 |
|
| 96 |
## How to Get Started with the Model
|
| 97 |
|
| 98 |
Use the code below to get started with the model.
|
| 99 |
|
| 100 |
-
|
|
|
|
|
|
|
| 101 |
|
| 102 |
-
|
|
|
|
|
|
|
| 103 |
|
| 104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
|
| 106 |
-
|
|
|
|
| 107 |
|
| 108 |
-
|
|
|
|
|
|
|
| 109 |
|
| 110 |
-
|
|
|
|
| 111 |
|
| 112 |
-
|
|
|
|
|
|
|
| 113 |
|
| 114 |
-
|
| 115 |
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
#### Training Hyperparameters
|
| 120 |
|
| 121 |
-
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
| 122 |
|
| 123 |
-
#### Speeds, Sizes, Times [optional]
|
| 124 |
-
|
| 125 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
| 126 |
-
|
| 127 |
-
[More Information Needed]
|
| 128 |
|
| 129 |
## Evaluation
|
| 130 |
|
|
|
|
| 26 |
|
| 27 |
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
|
| 28 |
|
| 29 |
+
- **Developed by:** Sinanmz
|
| 30 |
+
- **Model type:** Multiclass Multilabel Classifier
|
| 31 |
+
- **Language(s) (NLP):** English
|
| 32 |
+
- **License:** MIT
|
| 33 |
+
- **Finetuned from model optional:** google-bert/bert-base-uncased
|
| 34 |
|
| 35 |
### Model Sources [optional]
|
| 36 |
|
| 37 |
<!-- Provide the basic links for the model. -->
|
| 38 |
|
| 39 |
+
- **Repository:** https://github.com/Sinanmz/MIR
|
| 40 |
|
| 41 |
## Uses
|
| 42 |
|
|
|
|
| 62 |
- **Content Creators:** Gaining better visibility through accurate classification and tagging of their work.
|
| 63 |
- **Platform Operators:** Improving user engagement and satisfaction with more personalized and accurate content delivery.
|
| 64 |
|
| 65 |
+
## How to Get Started with the Model
|
| 66 |
|
| 67 |
+
Here's the "How to Get Started with the Model" section for your model card:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
|
| 69 |
+
---
|
| 70 |
|
| 71 |
## How to Get Started with the Model
|
| 72 |
|
| 73 |
Use the code below to get started with the model.
|
| 74 |
|
| 75 |
+
```python
|
| 76 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 77 |
+
import torch
|
| 78 |
|
| 79 |
+
# Load the tokenizer and the model
|
| 80 |
+
tokenizer = AutoTokenizer.from_pretrained('Sinanmz/Movie_Genre_Classifier')
|
| 81 |
+
model = AutoModelForSequenceClassification.from_pretrained('Sinanmz/Movie_Genre_Classifier')
|
| 82 |
|
| 83 |
+
# Example movie summary (summary of Dune: Part Two)
|
| 84 |
+
movie_summary = """Paul Atreides unites with Chani and the Fremen while on a warpath of
|
| 85 |
+
revenge against the conspirators who destroyed his family. Facing a choice between the
|
| 86 |
+
love of his life and the fate of the known universe, he endeavors to prevent a terrible
|
| 87 |
+
future only he can foresee."""
|
| 88 |
|
| 89 |
+
# Tokenize the input
|
| 90 |
+
inputs = tokenizer(movie_summary, return_tensors="pt", truncation=True, padding=True)
|
| 91 |
|
| 92 |
+
# Get model predictions
|
| 93 |
+
outputs = model(**inputs)
|
| 94 |
+
logits = outputs.logits
|
| 95 |
|
| 96 |
+
# Convert logits to probabilities
|
| 97 |
+
probs = torch.sigmoid(logits)
|
| 98 |
|
| 99 |
+
# Print the predicted genres
|
| 100 |
+
genre_labels = ["Action", "Drama", "Comedy", "Animation", "Crime"]
|
| 101 |
+
predicted_genres = [genre_labels[i] for i in range(len(genre_labels)) if probs[0][i] >= 0.5]
|
| 102 |
|
| 103 |
+
print(f"Predicted genres: {predicted_genres}")
|
| 104 |
|
| 105 |
+
# Output:
|
| 106 |
+
# Predicted genres: ['Action', 'Drama']
|
| 107 |
+
```
|
|
|
|
| 108 |
|
|
|
|
| 109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
|
| 111 |
## Evaluation
|
| 112 |
|