super-apple commited on
Commit
f0a648e
·
verified ·
1 Parent(s): 2813ce7

Upload folder using huggingface_hub

Browse files
Files changed (6) hide show
  1. README.md +30 -3
  2. config.json +32 -0
  3. model.safetensors +3 -0
  4. tokenizer.json +0 -0
  5. tokenizer_config.json +24 -0
  6. training_args.bin +3 -0
README.md CHANGED
@@ -1,3 +1,30 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # spam-classifier-ru 🛡️
2
+
3
+ Модель `spam-classifier-ru` предназначена для бинарной классификации текстов на русском языке (Спам / Не спам).
4
+
5
+ Модель представляет собой fine-tuned версию архитектуры `cointegrated/rubert-tiny2`.
6
+
7
+ ## 📚 Данные для обучения (Training Data)
8
+ В качестве основы использовалась подвыборка в размере 500 000 строк из открытого датасета [ruSpamModels/russian-spam-detection](https://huggingface.co/datasets/ruSpamModels/russian-spam-detection).
9
+
10
+ ## Пример использования
11
+
12
+ ```python
13
+ import torch
14
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
15
+
16
+ model_name = "твой_ник/spam-classifier-ru"
17
+
18
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
19
+ model = AutoModelForSequenceClassification.from_pretrained(model_name)
20
+
21
+ text = "3APA60T0K 6E3 BЛ0ЖEHИЙ 0T 5OOO PY6ЛEЙ B ДEHb!"
22
+ inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True, max_length=128)
23
+
24
+ with torch.no_grad():
25
+ outputs = model(**inputs)
26
+
27
+ predicted_class = torch.argmax(outputs.logits, dim=-1).item()
28
+
29
+ print("Это спам!" if predicted_class == 1 else "Это нормальный текст.")
30
+ ```
config.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_cross_attention": false,
3
+ "architectures": [
4
+ "BertForSequenceClassification"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "bos_token_id": null,
8
+ "classifier_dropout": null,
9
+ "dtype": "float32",
10
+ "emb_size": 312,
11
+ "eos_token_id": null,
12
+ "gradient_checkpointing": false,
13
+ "hidden_act": "gelu",
14
+ "hidden_dropout_prob": 0.1,
15
+ "hidden_size": 312,
16
+ "initializer_range": 0.02,
17
+ "intermediate_size": 600,
18
+ "is_decoder": false,
19
+ "layer_norm_eps": 1e-12,
20
+ "max_position_embeddings": 2048,
21
+ "model_type": "bert",
22
+ "num_attention_heads": 12,
23
+ "num_hidden_layers": 3,
24
+ "pad_token_id": 0,
25
+ "position_embedding_type": "absolute",
26
+ "problem_type": "single_label_classification",
27
+ "tie_word_embeddings": true,
28
+ "transformers_version": "5.8.1",
29
+ "type_vocab_size": 2,
30
+ "use_cache": false,
31
+ "vocab_size": 83828
32
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c8479afbc1130695e5f64406ad00c11322d8dac16b653460718195cbfcbde74
3
+ size 116784136
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "backend": "tokenizers",
3
+ "cls_token": "[CLS]",
4
+ "do_basic_tokenize": true,
5
+ "do_lower_case": false,
6
+ "is_local": false,
7
+ "local_files_only": false,
8
+ "mask_token": "[MASK]",
9
+ "max_length": 512,
10
+ "model_max_length": 2048,
11
+ "never_split": null,
12
+ "pad_to_multiple_of": null,
13
+ "pad_token": "[PAD]",
14
+ "pad_token_type_id": 0,
15
+ "padding_side": "right",
16
+ "sep_token": "[SEP]",
17
+ "stride": 0,
18
+ "strip_accents": null,
19
+ "tokenize_chinese_chars": true,
20
+ "tokenizer_class": "BertTokenizer",
21
+ "truncation_side": "right",
22
+ "truncation_strategy": "longest_first",
23
+ "unk_token": "[UNK]"
24
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ee9c17e6009e7c10b082089f2b68a1ce60441bbb251de76c0d81d0f68812f32e
3
+ size 5265