Update README.md
Browse files
README.md
CHANGED
|
@@ -11,6 +11,37 @@ base_model:
|
|
| 11 |
library_name: transformers
|
| 12 |
---
|
| 13 |
|
| 14 |
-
Repo: https://github.com/foltaProject/glosslm
|
|
|
|
| 15 |
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
library_name: transformers
|
| 12 |
---
|
| 13 |
|
| 14 |
+
- Repo: https://github.com/foltaProject/glosslm
|
| 15 |
+
- Paper: https://arxiv.org/abs/2403.06399
|
| 16 |
|
| 17 |
+
Usage:
|
| 18 |
+
```python
|
| 19 |
+
import transformers
|
| 20 |
+
|
| 21 |
+
# Your inputs
|
| 22 |
+
transcription = "o sey xtok rixoqiil"
|
| 23 |
+
translation = "O sea busca esposa."
|
| 24 |
+
lang = "Uspanteco"
|
| 25 |
+
metalang = "Spanish"
|
| 26 |
+
is_segmented = False
|
| 27 |
+
|
| 28 |
+
prompt = f"""Provide the glosses for the following transcription in {lang}.
|
| 29 |
+
|
| 30 |
+
Transcription in {lang}: {transcription}
|
| 31 |
+
Transcription segmented: {is_segmented}
|
| 32 |
+
Translation in {metalang}: {translation}\n
|
| 33 |
+
Glosses:
|
| 34 |
+
"""
|
| 35 |
+
|
| 36 |
+
model = transformers.T5ForConditionalGeneration.from_pretrained("lecslab/glosslm")
|
| 37 |
+
tokenizer = transformers.ByT5Tokenizer.from_pretrained(
|
| 38 |
+
"google/byt5-base", use_fast=False
|
| 39 |
+
)
|
| 40 |
+
|
| 41 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
| 42 |
+
outputs = tokenizer.batch_decode(
|
| 43 |
+
model.generate(**inputs, max_length=1024), skip_special_tokens=True
|
| 44 |
+
)
|
| 45 |
+
print(outputs[0])
|
| 46 |
+
# o sea COM-buscar E3S-esposa
|
| 47 |
+
```
|