File size: 7,777 Bytes
bbd1ded
71f242e
bbd1ded
af732dd
 
 
 
 
 
 
 
 
bbd1ded
 
ee43a15
bbd1ded
ee43a15
bbd1ded
 
 
 
 
 
ee43a15
bbd1ded
af732dd
bbd1ded
af732dd
 
 
7279e30
71f242e
bbd1ded
 
 
af732dd
 
 
 
 
 
 
 
 
 
ee43a15
af732dd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bbd1ded
 
 
ee43a15
af732dd
 
 
 
bbd1ded
 
 
af732dd
 
 
 
 
bbd1ded
 
 
 
 
af732dd
bbd1ded
af732dd
 
 
 
 
bbd1ded
af732dd
bbd1ded
af732dd
bbd1ded
af732dd
 
 
 
bbd1ded
af732dd
bbd1ded
af732dd
bbd1ded
af732dd
 
 
 
 
 
bbd1ded
 
 
af732dd
bbd1ded
 
 
ee43a15
bbd1ded
af732dd
bbd1ded
af732dd
bbd1ded
af732dd
bbd1ded
af732dd
bbd1ded
af732dd
bbd1ded
af732dd
 
 
bbd1ded
af732dd
bbd1ded
af732dd
 
 
bbd1ded
af732dd
bbd1ded
af732dd
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
---
license: other
library_name: transformers
pipeline_tag: text-generation
tags:
- armenian
- llm
- pretrained
language:
- hy
- ru
- en
---

# HyGPT-10b

HyGPT-10b is the first Armenian large language model that has been pretrained on corpus of Armenian text data. This model is designed to understand and generate Armenian text, making it a pioneering high-quality language model specifically created for the Armenian language.

## Model Details

### Model Description


HyGPT-10b is a decoder-only language model based on Google's Gemma-2-9b architecture that has been further pretrained on 10B tokens of Armenian text. 

A key technical modification in this model is the decoupling of the embedding and LM head layers, allowing the output layer to be trained independently, which can improve the model's ability to generate accurate Armenian text.

- **Developed by:** [Gen2B](https://gen2b.ai/) & [NCCAIT](http://arm.ican24.net/)
- **Model type:** Decoder-only language model
- **Language(s) (NLP):** Armenian, English, Russian
- **Technical Report:** [link](https://gen2b.ai/hygpt-release-1-0)
- **License:** [HyGPT Permissive Use License](https://huggingface.co/Gen2B/HyGPT-10b/raw/main/LICENSE)

## Uses

First, install the Transformers library with:
```sh
pip install -U transformers
```

Then, run this example:
```python
from transformers import AutoModelForCausalLM, AutoTokenizer, GenerationConfig
import torch

model_path = "Gen2B/HyGPT-10b"
tokenizer = AutoTokenizer.from_pretrained(model_path)
model = AutoModelForCausalLM.from_pretrained(
    model_path,
    torch_dtype=torch.float16,
    device_map="auto",
)

PROMPT = 'Ինչու է խոտը Կանաչ:'

inputs = tokenizer(
    PROMPT,
    return_tensors="pt",
)

print("Generating...")
generation_output = model.generate(
    input_ids=inputs["input_ids"].cuda(),
    generation_config=GenerationConfig(
        temperature=0.0001,
        repetition_penalty=1.1,
        do_sample=True
    ),
    return_dict_in_generate=True,
    output_scores=True,
    max_new_tokens=256,
)
for s in generation_output.sequences:
    print(tokenizer.decode(s))

# Կանաչ գույնի առկայությունը բուսականության մեջ պայմանավորված է կլորավուն քլորոֆիլային մոլեկուլների առկայությամբ, որոնք հանդիսանում են լույսի անդրադարձման և տարածման միակ աղբյուրները։ Առողջ բույսերում այդպիսի մոլեկուլներ շատ են, ուստի դրանցից արտացոլվող լույսի երանգը համապատասխանում է կանաչին։ Եթե ​​մոլեկուլների թիվը նվազում է, օրինակ՝ սովի կամ վիրուսային վարակի դեպքում, ապա բույսերի գույնը փոխվում է. Դեղին-շագանակագույն, կարմիր, կապույտ, սև։
```

### Direct Use

HyGPT-10b can be used directly for:
- Armenian text generation
- Question answering in Armenian
- Text completion for Armenian content
- Understanding Armenian language queries

## Bias, Risks, and Limitations

- The model may reflect biases present in the Armenian language training data
- Accuracy may vary across different Armenian dialects and regional variations
- The model may not have up-to-date knowledge beyond its training data
- Like all language models, it may occasionally generate incorrect or nonsensical responses
- The model's understanding of specialized Armenian terminology may be limited in certain domains

## Training Details

### Training Data

The model was pretrained on a diverse corpus of Armenian text data comprising approximately 10 billion tokens. The dataset includes:

- Armenian web content
- Armenian literature and publications
- Armenian news articles
- Armenian Wikipedia
- Other publicly available Armenian text sources

The data was collected with a focus on representing Armenian language usage across various domains and topics.

### Preprocessing

The Armenian text data underwent several preprocessing steps:
- Cleaning and normalization of Armenian text
- Removal of duplicate content
- Tokenization using the base Gemma tokenizer

### Training Procedure

The model was further pretrained from the google/gemma-2-9b base model using a pretraining approach. A key modification was decoupling the embedding and LM head layers, allowing the output layer to be trained independently. This approach was adopted based on a series of short experiments followed by evaluation on three publicly available Armenian language datasets. The results demonstrated that training the embedding and output layers separately yields higher accuracy according to metrics, compared to both the standard synchronized training of embedding and output layers, as well as configurations with frozen embedding layer, frozen output layer, or both layers frozen. The table below shows the evaluation results across different configurations:

| | **train emb / train lm** | *train sync(emb/lm)* | *train emb / freeze lm* | *freeze emb / train lm* | *freeze emb / freeze lm* |
|---|---|---|---|---|---|
| [facebook/belebele](https://huggingface.co/datasets/facebook/belebele) | **56.8** | *54.6* | *51.8* | *56.2* | *56.6* |
| [gayaneghazaryan/SynDARn](https://huggingface.co/datasets/gayaneghazaryan/SynDARn) | **73.0** | *71.3* | *71.1* | *72.5* | *72.0* |
| [CohenForAI/mGlue-base-44](https://huggingface.co/datasets/CohenForAI/mGlue-base-44) | **34.2** | *33.9* | *33.3* | *34.1* | *34.0* |
| avg | **54.7** | *53.3* | *52.1* | *54.3* | *54.2* |

### Results

The model demonstrates strong performance on Armenian language tasks, showing significant improvements over models without Armenian-specific pretraining. Detailed benchmark results will be published in the future.

#### Summary

HyGPT-10b shows promising capabilities for Armenian language understanding and generation, making it a valuable resource for Armenian NLP applications. Additionally, the model serves as an excellent foundation model for further fine-tuning on specific data and domains, allowing developers to adapt it to specialized Armenian language tasks and industry-specific applications.

---

## License and Terms of Use

This model is based on Gemma and is distributed according to the [Gemma Terms of Use](https://ai.google.dev/gemma/terms).

**Notice**: Gemma is provided under and subject to the Gemma Terms of Use found at [ai.google.dev/gemma/terms](https://ai.google.dev/gemma/terms).

### Modifications Notice

This model is a modified version of the original Gemma-2-9b model. The modifications include:
1. Further pretraining on 10 billion tokens of Armenian text data
2. Decoupling of the embedding and LM head layers to allow independent training of the output layer

### Use Restrictions

According to the Gemma Terms of Use, the model should not be used:
1. For purposes outlined in the [Gemma Prohibited Use Policy](https://ai.google.dev/gemma/prohibited_use_policy)
2. In violation of applicable laws and regulations

## Disclaimer of Warranty

UNLESS REQUIRED BY APPLICABLE LAW, THE GEMMA SERVICES, AND OUTPUTS, ARE PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE FOR DETERMINING THE APPROPRIATENESS OF USING, REPRODUCING, MODIFYING, PERFORMING, DISPLAYING OR DISTRIBUTING ANY OF THE GEMMA SERVICES OR OUTPUTS AND ASSUME ANY AND ALL RISKS ASSOCIATED WITH YOUR USE OR DISTRIBUTION OF ANY OF THE GEMMA SERVICES OR OUTPUTS AND YOUR EXERCISE OF RIGHTS AND PERMISSIONS UNDER THIS AGREEMENT.