Update README.md
Browse files
README.md
CHANGED
|
@@ -20,22 +20,47 @@ pipeline_tag: fill-mask
|
|
| 20 |
<table style="width:100%;height:100%">
|
| 21 |
<tr>
|
| 22 |
<td colspan=2>
|
| 23 |
-
<h2>
|
| 24 |
</td>
|
| 25 |
</tr>
|
| 26 |
<tr style="width:100%;height:100%">
|
| 27 |
<td width=50%>
|
| 28 |
-
<p>Обучаван над
|
| 29 |
-
<p
|
| 30 |
</td>
|
| 31 |
<td>
|
| 32 |
-
|
| 33 |
-
|
| 34 |
</td>
|
| 35 |
</tr>
|
| 36 |
</table>
|
| 37 |
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
<div class="inline-flex flex-col" style="line-height: 1.5;padding-right:50px">
|
| 41 |
<div style="text-align: center; margin-top: 3px; font-size: 16px; font-weight: 800">Author</div>
|
|
@@ -58,7 +83,7 @@ pipeline_tag: fill-mask
|
|
| 58 |
|
| 59 |
<div class="inline-flex flex-col" style="line-height: 1.5;">
|
| 60 |
|
| 61 |
-
<div style="text-align: center; margin-top: 3px; font-size: 16px; font-weight: 800">
|
| 62 |
<a href="https://www.ai.gov.rs/">
|
| 63 |
<div class="flex">
|
| 64 |
<div
|
|
@@ -70,8 +95,8 @@ pipeline_tag: fill-mask
|
|
| 70 |
</a>
|
| 71 |
<div style="text-align: center; font-size: 16px; font-weight: 800">National AI platform</div>
|
| 72 |
<div>
|
| 73 |
-
<a href="https://
|
| 74 |
-
<div style="text-align: center; font-size: 14px;">
|
| 75 |
</a>
|
| 76 |
</div>
|
| 77 |
</div>
|
|
|
|
| 20 |
<table style="width:100%;height:100%">
|
| 21 |
<tr>
|
| 22 |
<td colspan=2>
|
| 23 |
+
<h2>Tesla 81</h2>
|
| 24 |
</td>
|
| 25 |
</tr>
|
| 26 |
<tr style="width:100%;height:100%">
|
| 27 |
<td width=50%>
|
| 28 |
+
<p>Обучаван над корпусима српског и српскохрватског језика - 20 милијарди речи</p>
|
| 29 |
+
<p>Једнака подршка уноса на ћирилици и латиници!</p>
|
| 30 |
</td>
|
| 31 |
<td>
|
| 32 |
+
<p>Trained on Serbian and Serbo-Croatian corpora - 20 billion words</p>
|
| 33 |
+
<p>Equal support for Cyrillic and Latin input!</p>
|
| 34 |
</td>
|
| 35 |
</tr>
|
| 36 |
</table>
|
| 37 |
|
| 38 |
+
```python
|
| 39 |
+
>>> from transformers import pipeline
|
| 40 |
+
>>> unmasker = pipeline('fill-mask', model='te-sla/tesla-81')
|
| 41 |
+
>>> unmasker("Kada bi čovek znao gde će pasti on bi<mask>.")
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
```python
|
| 45 |
+
>>> from transformers import AutoTokenizer, AutoModelForMaskedLM
|
| 46 |
+
>>> from torch import LongTensor, no_grad
|
| 47 |
+
>>> from scipy import spatial
|
| 48 |
+
>>> tokenizer = AutoTokenizer.from_pretrained('te-sla/tesla-81')
|
| 49 |
+
>>> model = AutoModelForMaskedLM.from_pretrained('te-sla/tesla-81', output_hidden_states=True)
|
| 50 |
+
>>> x = " pas"
|
| 51 |
+
>>> y = " mačka"
|
| 52 |
+
>>> z = " svemir"
|
| 53 |
+
>>> tensor_x = LongTensor(tokenizer.encode(x, add_special_tokens=False)).unsqueeze(0)
|
| 54 |
+
>>> tensor_y = LongTensor(tokenizer.encode(y, add_special_tokens=False)).unsqueeze(0)
|
| 55 |
+
>>> tensor_z = LongTensor(tokenizer.encode(z, add_special_tokens=False)).unsqueeze(0)
|
| 56 |
+
>>> model.eval()
|
| 57 |
+
>>> with no_grad():
|
| 58 |
+
>>> vektor_x = model(input_ids=tensor_x).hidden_states[-1].squeeze()
|
| 59 |
+
>>> vektor_y = model(input_ids=tensor_y).hidden_states[-1].squeeze()
|
| 60 |
+
>>> vektor_z = model(input_ids=tensor_z).hidden_states[-1].squeeze()
|
| 61 |
+
>>> print(spatial.distance.cosine(vektor_x, vektor_y))
|
| 62 |
+
>>> print(spatial.distance.cosine(vektor_x, vektor_z))
|
| 63 |
+
```
|
| 64 |
|
| 65 |
<div class="inline-flex flex-col" style="line-height: 1.5;padding-right:50px">
|
| 66 |
<div style="text-align: center; margin-top: 3px; font-size: 16px; font-weight: 800">Author</div>
|
|
|
|
| 83 |
|
| 84 |
<div class="inline-flex flex-col" style="line-height: 1.5;">
|
| 85 |
|
| 86 |
+
<div style="text-align: center; margin-top: 3px; font-size: 16px; font-weight: 800">Computation</div>
|
| 87 |
<a href="https://www.ai.gov.rs/">
|
| 88 |
<div class="flex">
|
| 89 |
<div
|
|
|
|
| 95 |
</a>
|
| 96 |
<div style="text-align: center; font-size: 16px; font-weight: 800">National AI platform</div>
|
| 97 |
<div>
|
| 98 |
+
<a href="https://www.ai.gov.rs/">
|
| 99 |
+
<div style="text-align: center; font-size: 14px;">ai.gov.rs</div>
|
| 100 |
</a>
|
| 101 |
</div>
|
| 102 |
</div>
|