File size: 1,793 Bytes
d870346
 
 
16014b0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
67
68
69
70
71
72
73
74
75
76
---

license: mit
---

language:

- en
  pipeline_tag: text-generation

  tags:



---



# Qwen2-1.5B-Sign



## Introduction



Qwen2-Sign is a text to sige model base on Qwen2.



## Finetune Details



- Finetune dataset: [alpaca-zh-text2sign](https://huggingface.co/datasets/thundax/alpaca-zh-text2sign)

- Finetune parameter



| Parameter                    | Value |

|------------------------------|--------|

| learning_rate                | 5e-05 |
| train_batch_size             | 4 |
| eval_batch_size              | 4 |
| gradient_accumulation_steps  | 8 |
| total_train_batch_size       | 32 |

| lr_scheduler_type            | cosine |

| lr_scheduler_warmup_steps    | 100 |
| num_epochs                   | 4 |





## Quickstart



```python

from transformers import AutoModelForCausalLM, AutoTokenizer



device = "cuda"  # the device to load the model onto



model = AutoModelForCausalLM.from_pretrained(
    "thundax/Qwen2-1.5B-Sign",

    torch_dtype="auto",

    device_map="auto"

)

tokenizer = AutoTokenizer.from_pretrained("thundax/Qwen2-1.5B-Sign")


text = "你好,世界!"
text = f'Translate sentence into labels\n{text}\n'
model_inputs = tokenizer([text], return_tensors="pt").to(device)

generated_ids = model.generate(

    model_inputs.input_ids,

    max_new_tokens=512

)

generated_ids = [
    output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)

]


response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
```



## Citation



If you find our work helpful, feel free to give us a cite.



```
@software{qwen2-sign,
  author = {thundax},
  title = {qwen2-sign: A Tool for Text to Sign},
  year = {2024},
  url = {https://github.com/thundax-lyp},
}
```