Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -33,12 +33,7 @@ The following table compares **THIVLVC** against major industry standards across
|
|
| 33 |
|
| 34 |
## Usage
|
| 35 |
|
| 36 |
-
|
| 37 |
-
```bash
|
| 38 |
-
pip install transformers torch
|
| 39 |
-
```
|
| 40 |
-
|
| 41 |
-
Basic usage in Python:
|
| 42 |
|
| 43 |
```python
|
| 44 |
from transformers import AutoTokenizer, T5ForConditionalGeneration
|
|
@@ -49,11 +44,13 @@ model = T5ForConditionalGeneration.from_pretrained(model_name)
|
|
| 49 |
|
| 50 |
def lemmatize(text):
|
| 51 |
inputs = tokenizer(text, return_tensors="pt")
|
| 52 |
-
|
|
|
|
| 53 |
return tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 54 |
|
| 55 |
# Example
|
| 56 |
-
print(lemmatize("Amorem canat"))
|
|
|
|
| 57 |
```
|
| 58 |
|
| 59 |
## Dataset and Training
|
|
|
|
| 33 |
|
| 34 |
## Usage
|
| 35 |
|
| 36 |
+
**Important**: For best results, especially on short sentences or fragments, use **beam search** (`num_beams=5`).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
```python
|
| 39 |
from transformers import AutoTokenizer, T5ForConditionalGeneration
|
|
|
|
| 44 |
|
| 45 |
def lemmatize(text):
|
| 46 |
inputs = tokenizer(text, return_tensors="pt")
|
| 47 |
+
# Using beam search (num_beams=5) for better accuracy
|
| 48 |
+
outputs = model.generate(**inputs, max_length=128, num_beams=5, early_stopping=True)
|
| 49 |
return tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 50 |
|
| 51 |
# Example
|
| 52 |
+
print(lemmatize("Amorem canat"))
|
| 53 |
+
# Expected Output: "amor cano"
|
| 54 |
```
|
| 55 |
|
| 56 |
## Dataset and Training
|