PyTorch
Serbian
Croatian
xlm-roberta
File size: 7,687 Bytes
61dcf3c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5256358
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64d58ec
 
436218f
64d58ec
 
 
 
 
 
 
b1fc420
64d58ec
 
 
 
 
 
 
5256358
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28e13c8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5256358
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
---
license: cc-by-sa-4.0
datasets:
- procesaur/ZNANJE
- procesaur/STARS
- procesaur/Vikipedija
- procesaur/Vikizvornik
- jerteh/SrpELTeC
- procesaur/kisobran
language:
- sr
- hr
base_model:
- FacebookAI/xlm-roberta-large
---

<table style="width:100%;height:100%">
  <tr>
<td colspan=2>
  <h4><i class="highlight-container"><b class="highlight">TeslaXLM</b></i></h4>
</td>
    </tr>
  <tr style="width:100%;height:100%">
    <td width=50%>
      <p>Вишејезични модел, 561 милион параметара</p>
      <p>Обучаван над корпусима српског и српскохрватског језика - 20 милијарди речи</p>
      <p>Једнака подршка уноса на ћирилици и латиници!</p>
    </td>
    <td>
      <p>Multilingual model, 561 million parameters</p>
      <p>Trained on Serbian and Serbo-Croatian corpora - 20 billion words</p>
      <p>Equal support for Cyrillic and Latin input!</p>
    </td>
  </tr>
  </table>

```python
>>> from transformers import pipeline
>>> unmasker = pipeline('fill-mask', model='te-sla/teslaXLM')
>>> unmasker("Kada bi čovek znao gde će pasti on bi<mask>.")
```

```python
>>> from transformers import AutoTokenizer, AutoModelForMaskedLM
>>> from torch import LongTensor, no_grad
>>> from scipy import spatial
>>> tokenizer = AutoTokenizer.from_pretrained('te-sla/teslaXLM')
>>> model = AutoModelForMaskedLM.from_pretrained('te-sla/teslaXLM', output_hidden_states=True)
>>> x = " pas"
>>> y = " mačka"
>>> z = " svemir"
>>> tensor_x = LongTensor(tokenizer.encode(x, add_special_tokens=False)).unsqueeze(0)
>>> tensor_y = LongTensor(tokenizer.encode(y, add_special_tokens=False)).unsqueeze(0)
>>> tensor_z = LongTensor(tokenizer.encode(z, add_special_tokens=False)).unsqueeze(0)
>>> model.eval()
>>> with no_grad():
>>>     vektor_x = model(input_ids=tensor_x).hidden_states[-1].squeeze()
>>>     vektor_y = model(input_ids=tensor_y).hidden_states[-1].squeeze()
>>>     vektor_z = model(input_ids=tensor_z).hidden_states[-1].squeeze()
>>>     print(spatial.distance.cosine(vektor_x, vektor_y))
>>>     print(spatial.distance.cosine(vektor_x, vektor_z))
```

<table style="width:100%;height:100%">
<tr>
<td width=50%>
  <h5><i class="highlight-container"><b class="highlight">Евалуација XLMR модела за српски језик</b></i></h4>
</td>
<td>
  <h5><i class="highlight-container"><b class="highlight">Serbian XLMR models evaluation results</b></i></h4>
</td>
</tr>
  <tr colspan=2 style="width:100%;height:100%">
    <td colspan=2 >
    <img src="xlm-fm.png" class="cover" style="max-width:650px">
      <img src="xlm-pr.png" class="cover" style="max-width:650px">
      <img src="xlm-ds.png" class="cover" style="max-width:650px">
    </td>
  </tr>
  </table>

<div class="inline-flex flex-col" style="line-height: 1.5;padding-right:50px">
  <div style="text-align: center; margin-top: 3px; font-size: 16px; font-weight: 800">Author</div>
    <a href="https://huggingface.co/procesaur">  
      <div class="flex">
          <div
  			style="display:DISPLAY_1; margin-left: auto; margin-right: auto; width: 92px; height:92px; border-radius: 50%; 
            background-size: cover; background-image: url(&#39;https://cdn-uploads.huggingface.co/production/uploads/1673534533167-63bc254fb8c61b8aa496a39b.jpeg?w=200&h=200&f=face&#39;)">
          </div>
      </div>
    </a>
    <div style="text-align: center; font-size: 16px; font-weight: 800">Mihailo Škorić</div>
    <div>  
      <a href="https://huggingface.co/procesaur">
      	<div style="text-align: center; font-size: 14px;">@procesaur</div>
      </a>
    </div>
  </div>
</div>

<div class="inline-flex flex-col" style="line-height: 1.5;padding-right:50px">
  <div style="text-align: center; margin-top: 3px; font-size: 16px; font-weight: 800">Author</div>
    <a href="https://huggingface.co/tanor">  
      <div class="flex">
          <div
  			style="display:DISPLAY_1; margin-left: auto; margin-right: auto; width: 92px; height:92px; border-radius: 50%; 
            background-size: cover; background-image: url('https://cdn-avatars.huggingface.co/v1/production/uploads/6409d3d71ee054d66a673701/KTOOnCRS9NhpAMZIvLlU7.png?w=200&h=200&f=face')">
          </div>
      </div>
    </a>
    <div style="text-align: center; font-size: 16px; font-weight: 800">Saša Petalinkar</div>
    <div>  
      <a href="https://huggingface.co/tanor">
      	<div style="text-align: center; font-size: 14px;">@tanor</div>
      </a>
    </div>
  </div>
</div>

<div class="inline-flex flex-col" style="line-height: 1.5;"> 
  <div style="text-align: center; margin-top: 3px; font-size: 16px; font-weight: 800">Computation</div>
    <a href="https://tesla.rgf.bg.ac.rs">  
      <div class="flex">
          <div
  			style="display:DISPLAY_1; margin-left: auto; margin-right: auto; width: 92px; height:92px; border-radius: 50%; 
            background-size: cover; background-image: url(https://cdn-avatars.huggingface.co/v1/production/uploads/63bc254fb8c61b8aa496a39b/TfM_-sc8-b34ddfhHBGTA.png?w=200&h=200&f=face)">
          </div>
      </div>
    </a>
    <div style="text-align: center; font-size: 16px; font-weight: 800">TESLA project</div>
    <div>  
      <a href="https://huggingface.co/te-sla">
      	<div style="text-align: center; font-size: 14px;">@te-sla</div>
      </a>
    </div>
  </div>
</div>
<br/>

## Cit.

```bibtex
@inproceedings{skoricxlm,
  author    = {Mihailo Škorić, Saša Petalinkar},
  title     = {New XLM-R-based language models for Serbian and Serbo-Croatian},
  booktitle   = {ARTIFICAL INTELLIGENCE CONFERENCE},
  year      = {2024},
  address = {Belgrade}
  publisher = {SASA, Belgrade},
  url       = {}
}
```
<br/>
<div id="zastava">
  <div class="grb">
    <img src="https://www.ai.gov.rs/img/logo_60x120-2.png" style="position:relative; left:30px; z-index:10; height:85px">
  </div>
  <table width=100% style="border:0px">
    <tr style="background-color:#C6363C;width:100%;border:0px;height:30px"><td style="width:100vw"></td></tr>
    <tr style="background-color:#0C4076;width:100%;border:0px;height:30px"><td></td></tr>
    <tr style="background-color:#ffffff;width:100%;border:0px;height:30px"><td></td></tr>
  </table>
</div>

<table style="width:100%;height:100%">
  <tr style="width:100%;height:100%">
    <td width=50%>
       <p>Истраживање jе спроведено уз подршку Фонда за науку Републике Србиjе, #7276, Text Embeddings – Serbian Language Applications – TESLA</p>
    </td>
    <td>
      <p>This research was supported by the Science Fund of the Republic of Serbia, #7276, Text Embeddings - Serbian Language Applications - TESLA</p>
    </td>
  </tr>
</table>



<style>
  .ffeat: {
  color:red
  }
  
  .cover {
    width: 100%;
    margin-bottom: 5pt
  }
  
.highlight-container, .highlight {
  position: relative;
  text-decoration:none
}

.highlight-container {
  display: inline-block;
  
}

.highlight{
  color:white;
  text-transform:uppercase;
  font-size: 16pt;
}

  .highlight-container{
    padding:5px 10px
  }

.highlight-container:before {
  content: " ";
  display: block;
  height: 100%;
  width: 100%;
  margin-left: 0px;
  margin-right: 0px;
  position: absolute;
  background: #e80909;
  transform: rotate(2deg);
  top: -1px;
  left: -1px;
  border-radius: 20% 25% 20% 24%;
  padding: 10px 18px 18px 10px;
}

div.grb, #zastava>table {
  position:absolute;
  top:0px;
  left: 0px;
  margin:0px
}

  div.grb>img, #zastava>table{
    margin:0px
  }
  
#zastava {
  position: relative;
  margin-bottom:120px
}

  p {
    font-size:14pt
  }
</style>