Update README.md
Browse files
README.md
CHANGED
|
@@ -1,63 +1,75 @@
|
|
| 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 |
```
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
datasets:
|
| 4 |
+
- thundax/alpaca-zh-text2sign
|
| 5 |
+
language:
|
| 6 |
+
- zh
|
| 7 |
+
metrics:
|
| 8 |
+
- accuracy
|
| 9 |
+
base_model:
|
| 10 |
+
- Qwen/Qwen2.5-1.5B
|
| 11 |
+
pipeline_tag: text-generation
|
| 12 |
+
---
|
| 13 |
+
# Qwen2.5-1.5B-Sign
|
| 14 |
+
|
| 15 |
+
## Introduction
|
| 16 |
+
|
| 17 |
+
Qwen2.5-Sign is a text-to-chinese-sign model base on Qwen2.5
|
| 18 |
+
|
| 19 |
+
## Finetune Details
|
| 20 |
+
|
| 21 |
+
- Finetune dataset: [alpaca-zh-text2sign](https://huggingface.co/datasets/thundax/alpaca-zh-text2sign)
|
| 22 |
+
- Finetune parameter
|
| 23 |
+
|
| 24 |
+
| Parameter | Value |
|
| 25 |
+
|-----------------------------|--------|
|
| 26 |
+
| learning_rate | 5e-05 |
|
| 27 |
+
| train_batch_size | 4 |
|
| 28 |
+
| eval_batch_size | 4 |
|
| 29 |
+
| gradient_accumulation_steps | 8 |
|
| 30 |
+
| total_train_batch_size | 32 |
|
| 31 |
+
| lr_scheduler_type | cosine |
|
| 32 |
+
| lr_scheduler_warmup_steps | 100 |
|
| 33 |
+
| num_epochs | 4 |
|
| 34 |
+
|
| 35 |
+
## Quickstart
|
| 36 |
+
|
| 37 |
+
```python
|
| 38 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 39 |
+
|
| 40 |
+
device = "cuda" # the device to load the model onto
|
| 41 |
+
|
| 42 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 43 |
+
"thundax/Qwen2.5-1.5B-Sign",
|
| 44 |
+
torch_dtype="auto",
|
| 45 |
+
device_map="auto"
|
| 46 |
+
)
|
| 47 |
+
tokenizer = AutoTokenizer.from_pretrained("thundax/Qwen2.5-1.5B-Sign")
|
| 48 |
+
|
| 49 |
+
text = "站一个制高点看上海,上海的弄堂是壮观的景象。它是这城市背景一样的东西。"
|
| 50 |
+
input_text = f'Translate sentence into labels\n{text}\n'
|
| 51 |
+
model_inputs = tokenizer([input_text], return_tensors="pt").to(device)
|
| 52 |
+
|
| 53 |
+
generated_ids = model.generate(
|
| 54 |
+
model_inputs.input_ids,
|
| 55 |
+
max_new_tokens=512
|
| 56 |
+
)
|
| 57 |
+
generated_ids = [
|
| 58 |
+
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
| 59 |
+
]
|
| 60 |
+
|
| 61 |
+
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
## Citation
|
| 65 |
+
|
| 66 |
+
If you find our work helpful, feel free to give us a cite.
|
| 67 |
+
|
| 68 |
+
```
|
| 69 |
+
@software{qwen2-sign,
|
| 70 |
+
author = {thundax},
|
| 71 |
+
title = {qwen2-sign: A Tool for Text to Sign},
|
| 72 |
+
year = {2025},
|
| 73 |
+
url = {https://github.com/thundax-lyp},
|
| 74 |
+
}
|
| 75 |
```
|