File size: 1,912 Bytes
0000a2a 2881ced 0000a2a 2881ced 0000a2a 2881ced 0000a2a 2881ced 0000a2a 2881ced 3955bdc 2881ced 0000a2a 2881ced 0000a2a 2881ced 0000a2a 2881ced 0000a2a 2881ced 0000a2a 2881ced 0000a2a 2881ced 0000a2a 2881ced |
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 |
---
library_name: transformers
tags:
- generated_from_trainer
datasets:
- Helsinki-NLP/opus-100
model-index:
- name: string-repetition-tiny
results: []
license: mit
language:
- en
---
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
should probably proofread and complete it, then remove this comment. -->
# WeLT String Repetition
This model is traained using [this](https://github.com/sign/WeLT/blob/eab950ace0322f3299997dd5c9ff34f179ecc6a4/training/experiments/easy-tasks/string-repetition.yaml) config.
It is designed to take in English strings, and repeat them.
It is published here, so that it can be used in tests.
## Usage
```python
from pathlib import Path
import torch
from transformers import GenerationConfig
from transformers.trainer_utils import get_last_checkpoint
from welt.model import WordLatentTransformerForCausalLM
from welt.processor import TextImageProcessor
with torch.no_grad():
model = WordLatentTransformerForCausalLM.from_pretrained("sign/WeLT-string-repetition")
processor = TextImageProcessor.from_pretrained(model_path)
model.eval()
texts = [
# Texts from validation set
"<text>\x0EWouldn't it be more cruel for society to let people die... - ... when with some effort it could save them?\x0F<repeat> ",
"<text>\x0ESuperman's exact opposite who lives in the backwards Bizarro World.\x0F<repeat> ",
"<text>\x0EYOu dOn't know the half Of it.\x0F<repeat> ",
]
inputs = processor(texts, collated=True, packed=False)
outputs = model.generate(
**inputs,
processor=processor,
max_generated_words=32,
)
for text, output in zip(texts, outputs, strict=False):
print(f"Generated for '{text}': {output}")
```
### Framework versions
- Transformers 4.57.3
- Pytorch 2.9.1+cu130
- Datasets 4.4.1
- Tokenizers 0.22.1 |