Update README.md
Browse files
README.md
CHANGED
|
@@ -10,42 +10,6 @@ The script:
|
|
| 10 |
- Computes BLEU score using NLTK
|
| 11 |
- Saves predictions and evaluation results into a JSON file
|
| 12 |
|
| 13 |
-
|
| 14 |
-
## 📥 Input Format
|
| 15 |
-
|
| 16 |
-
The test file should be a `.jsonl` file where each line is a JSON object with the following fields:
|
| 17 |
-
|
| 18 |
-
```json
|
| 19 |
-
{
|
| 20 |
-
"system": "System prompt text",
|
| 21 |
-
"user": "<src=en><tgt=kk> Some English input",
|
| 22 |
-
"assistant": "Expected Kazakh translation"
|
| 23 |
-
}
|
| 24 |
-
```
|
| 25 |
-
|
| 26 |
-
## 📤 Output
|
| 27 |
-
|
| 28 |
-
The script will produce a file named like `eval_sync_KKEN_data_en_to_kk.json`, which contains:
|
| 29 |
-
- Model path
|
| 30 |
-
- Final BLEU score
|
| 31 |
-
- A list of examples with system prompt, cleaned user input, model prediction (hypothesis), and reference translation
|
| 32 |
-
|
| 33 |
-
Example output entry:
|
| 34 |
-
```json
|
| 35 |
-
{
|
| 36 |
-
"model": "/path/to/model",
|
| 37 |
-
"bleu": 27.53,
|
| 38 |
-
"examples": [
|
| 39 |
-
{
|
| 40 |
-
"system": "Translate this.",
|
| 41 |
-
"user": "Hello, how are you?",
|
| 42 |
-
"reference": "Сәлем, қалайсың?",
|
| 43 |
-
"hypothesis": "Сәлеметсіз бе, жағдайыңыз қалай?"
|
| 44 |
-
}
|
| 45 |
-
]
|
| 46 |
-
}
|
| 47 |
-
```
|
| 48 |
-
|
| 49 |
## ⚙️ Configuration
|
| 50 |
|
| 51 |
Modify these lines at the top of the script as needed:
|
|
@@ -64,39 +28,9 @@ To specify GPU devices:
|
|
| 64 |
export CUDA_VISIBLE_DEVICES=2,3,4,5
|
| 65 |
```
|
| 66 |
|
| 67 |
-
## 📦 Requirements
|
| 68 |
-
|
| 69 |
-
Install required packages:
|
| 70 |
-
|
| 71 |
-
```bash
|
| 72 |
-
pip install transformers torch nltk tqdm
|
| 73 |
-
```
|
| 74 |
-
|
| 75 |
-
Also, download NLTK data (if not yet):
|
| 76 |
-
|
| 77 |
-
```python
|
| 78 |
-
import nltk
|
| 79 |
-
nltk.download('punkt')
|
| 80 |
-
```
|
| 81 |
-
|
| 82 |
## ▶️ Run the Script
|
| 83 |
|
| 84 |
```bash
|
| 85 |
python eval_blue.py
|
| 86 |
```
|
| 87 |
|
| 88 |
-
This will:
|
| 89 |
-
- Load the model
|
| 90 |
-
- Run translation inference
|
| 91 |
-
- Compute BLEU score
|
| 92 |
-
- Save evaluation results to a `.json` file
|
| 93 |
-
|
| 94 |
-
## 📝 Notes
|
| 95 |
-
|
| 96 |
-
- Make sure your model and tokenizer directory follows Hugging Face format.
|
| 97 |
-
- The script uses `<start_of_turn>` and `<end_of_turn>` tokens to structure prompts for inference.
|
| 98 |
-
- Input strings are automatically cleaned of tags like `<src=..><tgt=..>` before generating output.
|
| 99 |
-
|
| 100 |
-
## 📧 Contact
|
| 101 |
-
|
| 102 |
-
For questions or feedback, please contact [Your Name or GitHub Profile].
|
|
|
|
| 10 |
- Computes BLEU score using NLTK
|
| 11 |
- Saves predictions and evaluation results into a JSON file
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
## ⚙️ Configuration
|
| 14 |
|
| 15 |
Modify these lines at the top of the script as needed:
|
|
|
|
| 28 |
export CUDA_VISIBLE_DEVICES=2,3,4,5
|
| 29 |
```
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
## ▶️ Run the Script
|
| 32 |
|
| 33 |
```bash
|
| 34 |
python eval_blue.py
|
| 35 |
```
|
| 36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|