lokas commited on
Commit
6888d7f
·
verified ·
1 Parent(s): 06bb8e6

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +26 -177
README.md CHANGED
@@ -109,198 +109,47 @@ metrics:
109
  - accuracy
110
  pipeline_tag: text-classification
111
  ---
112
- # Model Card for Model ID
113
 
114
- <!-- Provide a quick summary of what the model is/does. -->
115
 
116
- This modelcard aims to be a base template for new models. It has been generated using [this raw template](https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/templates/modelcard_template.md?plain=1).
117
 
118
- ## Model Details
119
 
120
- ### Model Description
121
 
122
- <!-- Provide a longer summary of what this model is. -->
123
 
124
 
125
 
126
- - **Developed by:** [More Information Needed]
127
- - **Shared by [optional]:** [More Information Needed]
128
- - **Model type:** [More Information Needed]
129
- - **Language(s) (NLP):** [More Information Needed]
130
- - **License:** [More Information Needed]
131
- - **Finetuned from model [optional]:** [More Information Needed]
132
 
133
- ### Model Sources [optional]
 
134
 
135
- <!-- Provide the basic links for the model. -->
 
136
 
137
- - **Repository:** [More Information Needed]
138
- - **Paper [optional]:** [More Information Needed]
139
- - **Demo [optional]:** [More Information Needed]
140
 
141
- ## Uses
 
142
 
143
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
 
144
 
145
- ### Direct Use
 
146
 
147
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
 
 
 
148
 
149
- [More Information Needed]
150
-
151
- ### Downstream Use [optional]
152
-
153
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
154
-
155
- [More Information Needed]
156
-
157
- ### Out-of-Scope Use
158
-
159
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
160
-
161
- [More Information Needed]
162
-
163
- ## Bias, Risks, and Limitations
164
-
165
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
166
-
167
- [More Information Needed]
168
-
169
- ### Recommendations
170
-
171
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
172
-
173
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
174
-
175
- ## How to Get Started with the Model
176
-
177
- Use the code below to get started with the model.
178
-
179
- [More Information Needed]
180
-
181
- ## Training Details
182
-
183
- ### Training Data
184
-
185
- <!-- This should link to a Data Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
186
-
187
- [More Information Needed]
188
-
189
- ### Training Procedure
190
-
191
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
192
-
193
- #### Preprocessing [optional]
194
-
195
- [More Information Needed]
196
-
197
-
198
- #### Training Hyperparameters
199
-
200
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
201
-
202
- #### Speeds, Sizes, Times [optional]
203
-
204
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
205
-
206
- [More Information Needed]
207
-
208
- ## Evaluation
209
-
210
- <!-- This section describes the evaluation protocols and provides the results. -->
211
-
212
- ### Testing Data, Factors & Metrics
213
-
214
- #### Testing Data
215
-
216
- <!-- This should link to a Data Card if possible. -->
217
-
218
- [More Information Needed]
219
-
220
- #### Factors
221
-
222
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
223
-
224
- [More Information Needed]
225
-
226
- #### Metrics
227
-
228
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
229
-
230
- [More Information Needed]
231
-
232
- ### Results
233
-
234
- [More Information Needed]
235
-
236
- #### Summary
237
-
238
-
239
-
240
- ## Model Examination [optional]
241
-
242
- <!-- Relevant interpretability work for the model goes here -->
243
-
244
- [More Information Needed]
245
-
246
- ## Environmental Impact
247
-
248
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
249
-
250
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
251
-
252
- - **Hardware Type:** [More Information Needed]
253
- - **Hours used:** [More Information Needed]
254
- - **Cloud Provider:** [More Information Needed]
255
- - **Compute Region:** [More Information Needed]
256
- - **Carbon Emitted:** [More Information Needed]
257
-
258
- ## Technical Specifications [optional]
259
-
260
- ### Model Architecture and Objective
261
-
262
- [More Information Needed]
263
-
264
- ### Compute Infrastructure
265
-
266
- [More Information Needed]
267
-
268
- #### Hardware
269
-
270
- [More Information Needed]
271
-
272
- #### Software
273
-
274
- [More Information Needed]
275
-
276
- ## Citation [optional]
277
-
278
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
279
-
280
- **BibTeX:**
281
-
282
- [More Information Needed]
283
-
284
- **APA:**
285
-
286
- [More Information Needed]
287
-
288
- ## Glossary [optional]
289
-
290
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
291
-
292
- [More Information Needed]
293
-
294
- ## More Information [optional]
295
-
296
- [More Information Needed]
297
-
298
- ## Model Card Authors [optional]
299
-
300
- [More Information Needed]
301
-
302
- ## Model Card Contact
303
-
304
- [More Information Needed]
305
 
 
306
 
 
109
  - accuracy
110
  pipeline_tag: text-classification
111
  ---
112
+ ## Username Classification Model 👤🔍
113
 
114
+ This is a machine learning model that can classify usernames into two categories: spam and non-spam. The model is based on the bert-base-multilingual-cased model. The input to the model is a string representing a username, and the output is a probability distribution over the two categories.
115
 
116
+ ## Dataset 📊
117
 
118
+ The model was trained on a dataset of usernames that were manually labeled as spam or non-spam. The dataset contains approximately 50,000 usernames, with a roughly equal number of examples in each category.
119
 
120
+ ## Performance 🏆
121
 
122
+ The model achieved an accuracy of 82% on the test set, and has been shown to generalize well to new data. However, as with any machine learning model, its performance may vary depending on the specific characteristics of the data.
123
 
124
 
125
 
126
+ ## Usage 🚀
127
+ To use this model, you can load it from Hugging Face using the Transformers library. Here is an example of how to do this:
 
 
 
 
128
 
129
+ ```python
130
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
131
 
132
+ tokenizer = AutoTokenizer.from_pretrained("lokas/spam-usernames-classifier")
133
+ model = AutoModelForSequenceClassification.from_pretrained("lokas/spam-usernames-classifier")
134
 
135
+ # Example usernames
136
+ usernames = ["Yousef10166", "توفيق الشارني", "Eng.salman1", "Moulay nadjem ALLOUAOUI", "Mmaarwa111", "Abdouflih99", "loka"]
 
137
 
138
+ # Tokenize the usernames
139
+ inputs = tokenizer(usernames, return_tensors="pt", padding=True, truncation=True)
140
 
141
+ # Get the model's predictions
142
+ outputs = model(**inputs)
143
 
144
+ # The predictions are in the form of logits, so we need to apply the softmax function to convert them to probabilities
145
+ probs = outputs.logits.softmax(dim=-1)
146
 
147
+ # Print the probabilities
148
+ print(probs)
149
+ ```
150
+ This example uses the dataset provided in the comment as an example. The usernames are classified as spam or non-spam.
151
 
152
+ ## License 📝
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
 
154
+ This project is licensed under the MIT License. See the LICENSE file for more details.
155