Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,40 @@
|
|
1 |
-
---
|
2 |
-
license: bsd-3-clause
|
3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: bsd-3-clause
|
3 |
+
---
|
4 |
+
# Hong Lou Meng Fine-tuned Model for Word Alignment
|
5 |
+
|
6 |
+
This repository contains a fine-tuned version of the **BERT multilingual model** (`bert-base-multilingual-cased`) on the **Hong Lou Meng** dataset for word alignment tasks. This model is fine-tuned using the [awesome-align](https://github.com/neulab/awesome-align) framework and is designed for Chinese-Vietnamese (Zh-Vn) alignment.
|
7 |
+
|
8 |
+
## Model Details
|
9 |
+
|
10 |
+
- **Base Model:** `bert-base-multilingual-cased`
|
11 |
+
- **Fine-tuned Dataset:** Excerpts from the classic "Hong Lou Meng" novel, annotated with Chinese and Vietnamese sentence pairs.
|
12 |
+
- **Alignment Task:** Fine-tuned to align word pairs in parallel texts for translation and linguistic analysis.
|
13 |
+
|
14 |
+
---
|
15 |
+
|
16 |
+
## Example Usage
|
17 |
+
|
18 |
+
Below is an example of how to use this model for word alignment using the `transformers` library:
|
19 |
+
|
20 |
+
```python
|
21 |
+
from transformers import AutoTokenizer, AutoModel
|
22 |
+
import torch
|
23 |
+
|
24 |
+
# Load model and tokenizer
|
25 |
+
model_name = "username/zh-vn-hongloumeng-align"
|
26 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
27 |
+
model = AutoModel.from_pretrained(model_name)
|
28 |
+
|
29 |
+
# Input sentences (Chinese and Vietnamese)
|
30 |
+
source_sentence = "第一回 甄士隱夢幻識通靈 賈雨村風塵懷閨秀"
|
31 |
+
target_sentence = "Hồi thứ nhất: Chân Sĩ Ẩn mộng ảo ngộ đá thiêng, Giả Vũ Thôn phong trần nhớ giai nhân."
|
32 |
+
|
33 |
+
# Tokenize inputs
|
34 |
+
inputs = tokenizer(source_sentence, target_sentence, return_tensors="pt", padding=True, truncation=True)
|
35 |
+
|
36 |
+
# Pass through model
|
37 |
+
outputs = model(**inputs)
|
38 |
+
|
39 |
+
# Further processing for alignment visualization or analysis would follow
|
40 |
+
print("Model outputs:", outputs)
|