khaledsoudy commited on
Commit
2bb7fc2
ยท
verified ยท
1 Parent(s): 973ec9f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +117 -3
README.md CHANGED
@@ -1,3 +1,117 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ datasets:
4
+ - arbml/arabic_100k_reviews
5
+ language:
6
+ - ar
7
+ - en
8
+ base_model:
9
+ - google-bert/bert-base-uncased
10
+ pipeline_tag: text-classification
11
+ tags:
12
+ - fine-tuning-bert-arbic
13
+ - fine-tuning-bert-sentiment-analysis
14
+ - sentiment-analysis
15
+ - text-classification
16
+ - ktrain-library
17
+ ---
18
+ Here's a modified README for your Hugging Face model page with the updated model name:
19
+
20
+ ---
21
+
22
+ # Fine-Tuned Arabic Sentiment Analysis with BERT ๐Ÿš€
23
+
24
+ This repository contains a fine-tuned **BERT** model for sentiment analysis of Arabic reviews. The model is trained on the **[Arabic 100k Reviews](https://www.kaggle.com/datasets/abedkhooli/arabic-100k-reviews)** dataset and can classify reviews into three sentiment categories: **Positive**, **Negative**, and **Mixed**.
25
+
26
+ ## Author ๐Ÿง‘โ€๐Ÿ’ป
27
+
28
+ Khaled Soudy
29
+ GitHub: [khaledsoudy-1](https://github.com/khaledsoudy-1)
30
+
31
+ ---
32
+
33
+ ## How to Use the Model
34
+
35
+ ### 1. Install Required Libraries
36
+
37
+ Make sure you have the **transformers** library installed:
38
+
39
+ ```bash
40
+ pip install transformers
41
+ ```
42
+
43
+ ### 2. Load the Fine-Tuned Model
44
+
45
+ You can load the fine-tuned model and tokenizer directly from Hugging Face using the following code:
46
+
47
+ ```python
48
+ from transformers import TFBertForSequenceClassification, BertTokenizer
49
+
50
+ # Load model and tokenizer from Hugging Face
51
+ model_name = "khaledsoudy/arabic-sentiment-bert-model"
52
+
53
+ # Load model
54
+ model = TFBertForSequenceClassification.from_pretrained(model_name)
55
+
56
+ # Load tokenizer
57
+ tokenizer = BertTokenizer.from_pretrained(model_name)
58
+ ```
59
+
60
+ ### 3. Use the Model for Prediction
61
+
62
+ To use the model for sentiment analysis on an Arabic text, follow these steps:
63
+
64
+ ```python
65
+ # Sample Arabic text for sentiment prediction
66
+ text = "ุงู„ูู†ุฏู‚ ุฑุงุฆุน ูˆ ุงู„ุฎุฏู…ุฉ ู…ู…ุชุงุฒุฉ"
67
+
68
+ # Tokenize the input text
69
+ inputs = tokenizer(text, return_tensors="tf")
70
+
71
+ # Get the model's prediction
72
+ outputs = model(**inputs)
73
+
74
+ # Get the predicted sentiment (assuming 3 classes: Positive, Negative, Mixed)
75
+ predicted_class = outputs.logits.argmax(axis=-1).numpy()[0]
76
+
77
+ # Map the predicted class index to sentiment labels
78
+ sentiment_labels = ['Positive', 'Negative', 'Mixed']
79
+ print(f"Predicted sentiment: {sentiment_labels[predicted_class]}")
80
+ ```
81
+
82
+ ### 4. Input Format
83
+
84
+ The model expects Arabic text input. The text should be preprocessed to remove unnecessary characters or diacritics for better results.
85
+
86
+ ### 5. Sentiment Labels
87
+
88
+ The model classifies the sentiment into three categories:
89
+
90
+ - **Positive** ๐ŸŒŸ
91
+ - **Negative** ๐Ÿ˜ 
92
+ - **Mixed** ๐Ÿค”
93
+
94
+ ## Model Details
95
+
96
+ - **Model Name:** `khaledsoudy/arabic-sentiment-bert-model`
97
+ - **Model Type:** `TFBertForSequenceClassification`
98
+ - **Language:** Arabic
99
+ - **Sentiment Classes:** Positive, Negative, Mixed
100
+
101
+ ## How to Fine-Tune This Model
102
+
103
+ You can fine-tune this model further using your own dataset. Check out the source code and related notebooks on my GitHub for detailed steps and guidance.
104
+
105
+ ## License ๐Ÿ“œ
106
+
107
+ This model is licensed under the MIT License.
108
+
109
+ ## Acknowledgments ๐Ÿ™
110
+
111
+ - **Hugging Face** for providing the platform to host models.
112
+ - **Google BERT** for the pre-trained model.
113
+ - **Kaggle** for the **Arabic 100k Reviews** dataset.
114
+
115
+ ---
116
+
117
+ This README is ready for use on your Hugging Face model page! It includes detailed usage instructions, links to your GitHub, and other relevant information.