pkedzia commited on
Commit
017acf2
verified
1 Parent(s): 4618f52

Update README.md

Browse files

Update Model Card

Files changed (1) hide show
  1. README.md +92 -1
README.md CHANGED
@@ -8,4 +8,95 @@ pipeline_tag: text-classification
8
  library_name: transformers
9
  tags:
10
  - news
11
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  library_name: transformers
9
  tags:
10
  - news
11
+ ---
12
+
13
+
14
+ ### Description
15
+ `polarity3c` is a classification model that is specialized for determining the polarity of texts from news portals. It was learned mostly on texts in Polish.
16
+
17
+ <center><img src="https://cdn-uploads.huggingface.co/production/uploads/644addfe9279988e0cbc296b/v6pz2sBwc3GCPL1Il8wVP.png" width=20%></center>
18
+
19
+ Annotations from the plWordnet were used as the basis for the data. A pre-learned model on these annotations, served as the model in Human in the loop,
20
+ to support the annotations for teaching the final model. The final model was learned on web content; data was manually collected and annotated.
21
+
22
+ As a model base, the `sdadas/polish-roberta-large-v2` model was used with a classification head. More about model construction is on out [blog](https://radlab.dev/2025/06/01/polaryzacja-3c-model-z-plg-na-hf/).
23
+
24
+ ### Architecture
25
+ ```
26
+ RobertaForSequenceClassification(
27
+ (roberta): RobertaModel(
28
+ (embeddings): RobertaEmbeddings(
29
+ (word_embeddings): Embedding(128001, 1024, padding_idx=1)
30
+ (position_embeddings): Embedding(514, 1024, padding_idx=1)
31
+ (token_type_embeddings): Embedding(1, 1024)
32
+ (LayerNorm): LayerNorm((1024,), eps=1e-05, elementwise_affine=True)
33
+ (dropout): Dropout(p=0.1, inplace=False)
34
+ )
35
+ (encoder): RobertaEncoder(
36
+ (layer): ModuleList(
37
+ (0-23): 24 x RobertaLayer(
38
+ (attention): RobertaAttention(
39
+ (self): RobertaSdpaSelfAttention(
40
+ (query): Linear(in_features=1024, out_features=1024, bias=True)
41
+ (key): Linear(in_features=1024, out_features=1024, bias=True)
42
+ (value): Linear(in_features=1024, out_features=1024, bias=True)
43
+ (dropout): Dropout(p=0.1, inplace=False)
44
+ )
45
+ (output): RobertaSelfOutput(
46
+ (dense): Linear(in_features=1024, out_features=1024, bias=True)
47
+ (LayerNorm): LayerNorm((1024,), eps=1e-05, elementwise_affine=True)
48
+ (dropout): Dropout(p=0.1, inplace=False)
49
+ )
50
+ )
51
+ (intermediate): RobertaIntermediate(
52
+ (dense): Linear(in_features=1024, out_features=4096, bias=True)
53
+ (intermediate_act_fn): GELUActivation()
54
+ )
55
+ (output): RobertaOutput(
56
+ (dense): Linear(in_features=4096, out_features=1024, bias=True)
57
+ (LayerNorm): LayerNorm((1024,), eps=1e-05, elementwise_affine=True)
58
+ (dropout): Dropout(p=0.1, inplace=False)
59
+ )
60
+ )
61
+ )
62
+ )
63
+ )
64
+ (classifier): RobertaClassificationHead(
65
+ (dense): Linear(in_features=1024, out_features=1024, bias=True)
66
+ (dropout): Dropout(p=0.1, inplace=False)
67
+ (out_proj): Linear(in_features=1024, out_features=3, bias=True)
68
+ )
69
+ )
70
+ ```
71
+
72
+ ### Usage
73
+ Example of use with transformers pipeline:
74
+ ```[python]
75
+ from transformers import pipeline
76
+
77
+ classifier = pipeline(model="radlab/polarity-3c", task="text-classification")
78
+
79
+ classifier("Text to classification")
80
+ ```
81
+
82
+ with sample data and `top_k=3`:
83
+ ```[python]
84
+ classifier("""
85
+ Po upadku re偶imu Asada w Syrii, mieszka艅cy, borykaj膮cy si臋 z ub贸stwem,
86
+ zacz臋li t艂umnie poszukiwa膰 skarb贸w, zach臋ceni legendami o zakopanych
87
+ bogactwach i dost臋pno艣ci膮 wykrywaczy metali, kt贸re sta艂y si臋 popularnym
88
+ towarem. Mimo, 偶e dzia艂alno艣膰 ta jest nielegalna, rz膮d przymyka oko,
89
+ a sprzedawcy oferuj膮 urz膮dzenia nawet dla dzieci. Poszukiwacze skupiaj膮
90
+ si臋 na obszarach historycznych, wierz膮c w legendy o skarbach ukrytych
91
+ przez staro偶ytne cywilizacje i wojska osma艅skie, cho膰 eksperci ostrzegaj膮
92
+ przed fa艂szywymi monetami i kradzie偶膮 artefakt贸w z muze贸w.""",
93
+ top_k=3
94
+ )
95
+ ```
96
+ the output is:
97
+ ```
98
+ [{'label': 'ambivalent', 'score': 0.9995126724243164},
99
+ {'label': 'negative', 'score': 0.00024663121439516544},
100
+ {'label': 'positive', 'score': 0.00024063512682914734}]
101
+ ```
102
+