Upload HyperCLOVAXForCausalLM
Browse files- README.md +199 -0
- config.json +72 -0
- configuration_hyperclovax.py +235 -0
- generation_config.json +8 -0
- model-00001-of-00002.safetensors +3 -0
- model-00002-of-00002.safetensors +3 -0
- model.safetensors.index.json +0 -0
README.md
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: transformers
|
| 3 |
+
tags: []
|
| 4 |
+
---
|
| 5 |
+
|
| 6 |
+
# Model Card for Model ID
|
| 7 |
+
|
| 8 |
+
<!-- Provide a quick summary of what the model is/does. -->
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
## Model Details
|
| 13 |
+
|
| 14 |
+
### Model Description
|
| 15 |
+
|
| 16 |
+
<!-- Provide a longer summary of what this model is. -->
|
| 17 |
+
|
| 18 |
+
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
|
| 19 |
+
|
| 20 |
+
- **Developed by:** [More Information Needed]
|
| 21 |
+
- **Funded by [optional]:** [More Information Needed]
|
| 22 |
+
- **Shared by [optional]:** [More Information Needed]
|
| 23 |
+
- **Model type:** [More Information Needed]
|
| 24 |
+
- **Language(s) (NLP):** [More Information Needed]
|
| 25 |
+
- **License:** [More Information Needed]
|
| 26 |
+
- **Finetuned from model [optional]:** [More Information Needed]
|
| 27 |
+
|
| 28 |
+
### Model Sources [optional]
|
| 29 |
+
|
| 30 |
+
<!-- Provide the basic links for the model. -->
|
| 31 |
+
|
| 32 |
+
- **Repository:** [More Information Needed]
|
| 33 |
+
- **Paper [optional]:** [More Information Needed]
|
| 34 |
+
- **Demo [optional]:** [More Information Needed]
|
| 35 |
+
|
| 36 |
+
## Uses
|
| 37 |
+
|
| 38 |
+
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
| 39 |
+
|
| 40 |
+
### Direct Use
|
| 41 |
+
|
| 42 |
+
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
| 43 |
+
|
| 44 |
+
[More Information Needed]
|
| 45 |
+
|
| 46 |
+
### Downstream Use [optional]
|
| 47 |
+
|
| 48 |
+
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
| 49 |
+
|
| 50 |
+
[More Information Needed]
|
| 51 |
+
|
| 52 |
+
### Out-of-Scope Use
|
| 53 |
+
|
| 54 |
+
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
| 55 |
+
|
| 56 |
+
[More Information Needed]
|
| 57 |
+
|
| 58 |
+
## Bias, Risks, and Limitations
|
| 59 |
+
|
| 60 |
+
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
| 61 |
+
|
| 62 |
+
[More Information Needed]
|
| 63 |
+
|
| 64 |
+
### Recommendations
|
| 65 |
+
|
| 66 |
+
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
| 67 |
+
|
| 68 |
+
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
| 69 |
+
|
| 70 |
+
## How to Get Started with the Model
|
| 71 |
+
|
| 72 |
+
Use the code below to get started with the model.
|
| 73 |
+
|
| 74 |
+
[More Information Needed]
|
| 75 |
+
|
| 76 |
+
## Training Details
|
| 77 |
+
|
| 78 |
+
### Training Data
|
| 79 |
+
|
| 80 |
+
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
| 81 |
+
|
| 82 |
+
[More Information Needed]
|
| 83 |
+
|
| 84 |
+
### Training Procedure
|
| 85 |
+
|
| 86 |
+
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
| 87 |
+
|
| 88 |
+
#### Preprocessing [optional]
|
| 89 |
+
|
| 90 |
+
[More Information Needed]
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
#### Training Hyperparameters
|
| 94 |
+
|
| 95 |
+
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
| 96 |
+
|
| 97 |
+
#### Speeds, Sizes, Times [optional]
|
| 98 |
+
|
| 99 |
+
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
| 100 |
+
|
| 101 |
+
[More Information Needed]
|
| 102 |
+
|
| 103 |
+
## Evaluation
|
| 104 |
+
|
| 105 |
+
<!-- This section describes the evaluation protocols and provides the results. -->
|
| 106 |
+
|
| 107 |
+
### Testing Data, Factors & Metrics
|
| 108 |
+
|
| 109 |
+
#### Testing Data
|
| 110 |
+
|
| 111 |
+
<!-- This should link to a Dataset Card if possible. -->
|
| 112 |
+
|
| 113 |
+
[More Information Needed]
|
| 114 |
+
|
| 115 |
+
#### Factors
|
| 116 |
+
|
| 117 |
+
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
| 118 |
+
|
| 119 |
+
[More Information Needed]
|
| 120 |
+
|
| 121 |
+
#### Metrics
|
| 122 |
+
|
| 123 |
+
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 124 |
+
|
| 125 |
+
[More Information Needed]
|
| 126 |
+
|
| 127 |
+
### Results
|
| 128 |
+
|
| 129 |
+
[More Information Needed]
|
| 130 |
+
|
| 131 |
+
#### Summary
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
## Model Examination [optional]
|
| 136 |
+
|
| 137 |
+
<!-- Relevant interpretability work for the model goes here -->
|
| 138 |
+
|
| 139 |
+
[More Information Needed]
|
| 140 |
+
|
| 141 |
+
## Environmental Impact
|
| 142 |
+
|
| 143 |
+
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 144 |
+
|
| 145 |
+
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
| 146 |
+
|
| 147 |
+
- **Hardware Type:** [More Information Needed]
|
| 148 |
+
- **Hours used:** [More Information Needed]
|
| 149 |
+
- **Cloud Provider:** [More Information Needed]
|
| 150 |
+
- **Compute Region:** [More Information Needed]
|
| 151 |
+
- **Carbon Emitted:** [More Information Needed]
|
| 152 |
+
|
| 153 |
+
## Technical Specifications [optional]
|
| 154 |
+
|
| 155 |
+
### Model Architecture and Objective
|
| 156 |
+
|
| 157 |
+
[More Information Needed]
|
| 158 |
+
|
| 159 |
+
### Compute Infrastructure
|
| 160 |
+
|
| 161 |
+
[More Information Needed]
|
| 162 |
+
|
| 163 |
+
#### Hardware
|
| 164 |
+
|
| 165 |
+
[More Information Needed]
|
| 166 |
+
|
| 167 |
+
#### Software
|
| 168 |
+
|
| 169 |
+
[More Information Needed]
|
| 170 |
+
|
| 171 |
+
## Citation [optional]
|
| 172 |
+
|
| 173 |
+
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
| 174 |
+
|
| 175 |
+
**BibTeX:**
|
| 176 |
+
|
| 177 |
+
[More Information Needed]
|
| 178 |
+
|
| 179 |
+
**APA:**
|
| 180 |
+
|
| 181 |
+
[More Information Needed]
|
| 182 |
+
|
| 183 |
+
## Glossary [optional]
|
| 184 |
+
|
| 185 |
+
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 186 |
+
|
| 187 |
+
[More Information Needed]
|
| 188 |
+
|
| 189 |
+
## More Information [optional]
|
| 190 |
+
|
| 191 |
+
[More Information Needed]
|
| 192 |
+
|
| 193 |
+
## Model Card Authors [optional]
|
| 194 |
+
|
| 195 |
+
[More Information Needed]
|
| 196 |
+
|
| 197 |
+
## Model Card Contact
|
| 198 |
+
|
| 199 |
+
[More Information Needed]
|
config.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"HyperCLOVAXForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"attention_multiplier": 0.0078125,
|
| 8 |
+
"attn_pdrop": 0.0,
|
| 9 |
+
"auto_map": {
|
| 10 |
+
"AutoConfig": "configuration_hyperclovax.HyperCLOVAXConfig",
|
| 11 |
+
"AutoModel": "naver-hyperclovax/HyperCLOVAX-SEED-Think-14B--modeling_hyperclovax.HyperCLOVAXModel",
|
| 12 |
+
"AutoModelForCausalLM": "naver-hyperclovax/HyperCLOVAX-SEED-Think-14B--modeling_hyperclovax.HyperCLOVAXForCausalLM"
|
| 13 |
+
},
|
| 14 |
+
"bos_token_id": 100257,
|
| 15 |
+
"embd_pdrop": 0.0,
|
| 16 |
+
"embedding_multiplier": 10.0,
|
| 17 |
+
"end_token_id": 100257,
|
| 18 |
+
"eos_token_id": 100257,
|
| 19 |
+
"head_dim": 128,
|
| 20 |
+
"hidden_act": "silu",
|
| 21 |
+
"hidden_size": 6144,
|
| 22 |
+
"initializer_range": 0.012727922061357854,
|
| 23 |
+
"intermediate_size": 14336,
|
| 24 |
+
"logits_scaling": 0.125,
|
| 25 |
+
"max_position_embeddings": 131072,
|
| 26 |
+
"mlp_bias": false,
|
| 27 |
+
"model_type": "hyperclovax",
|
| 28 |
+
"num_attention_heads": 48,
|
| 29 |
+
"num_hidden_layers": 38,
|
| 30 |
+
"num_key_value_heads": 8,
|
| 31 |
+
"pad_token_id": 100257,
|
| 32 |
+
"pretraining_tp": 1,
|
| 33 |
+
"quantization_config": {
|
| 34 |
+
"backend": "auto",
|
| 35 |
+
"batch_size": 1,
|
| 36 |
+
"bits": 4,
|
| 37 |
+
"block_name_to_quantize": null,
|
| 38 |
+
"cache_block_outputs": true,
|
| 39 |
+
"checkpoint_format": "gptq",
|
| 40 |
+
"damp_percent": 0.01,
|
| 41 |
+
"dataset": null,
|
| 42 |
+
"desc_act": false,
|
| 43 |
+
"exllama_config": {
|
| 44 |
+
"version": 1
|
| 45 |
+
},
|
| 46 |
+
"group_size": 128,
|
| 47 |
+
"max_input_length": null,
|
| 48 |
+
"meta": null,
|
| 49 |
+
"model_seqlen": null,
|
| 50 |
+
"module_name_preceding_first_block": null,
|
| 51 |
+
"modules_in_block_to_quantize": null,
|
| 52 |
+
"pad_token_id": null,
|
| 53 |
+
"quant_method": "gptq",
|
| 54 |
+
"sym": true,
|
| 55 |
+
"tokenizer": null,
|
| 56 |
+
"true_sequential": false,
|
| 57 |
+
"use_cuda_fp16": false,
|
| 58 |
+
"use_exllama": true
|
| 59 |
+
},
|
| 60 |
+
"resid_pdrop": 0.0,
|
| 61 |
+
"residual_multiplier": 1.0,
|
| 62 |
+
"rms_norm_eps": 1e-05,
|
| 63 |
+
"rope_scaling": null,
|
| 64 |
+
"rope_theta": 100000000,
|
| 65 |
+
"summary_first_dropout": 0.0,
|
| 66 |
+
"tie_word_embeddings": false,
|
| 67 |
+
"torch_dtype": "bfloat16",
|
| 68 |
+
"transformers_version": "4.52.3",
|
| 69 |
+
"use_cache": false,
|
| 70 |
+
"use_post_norm": true,
|
| 71 |
+
"vocab_size": 110592
|
| 72 |
+
}
|
configuration_hyperclovax.py
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# coding=utf-8
|
| 2 |
+
# This file was created for the HyperCLOVA X SEED 14B Think architecture.
|
| 3 |
+
# partially copied and modified from https://github.com/huggingface/transformers
|
| 4 |
+
# Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved.
|
| 5 |
+
#
|
| 6 |
+
# This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX
|
| 7 |
+
# and OPT implementations in this library. It has been modified from its
|
| 8 |
+
# original forms to accommodate minor architectural differences compared
|
| 9 |
+
# to GPT-NeoX and OPT used by the Meta AI team that trained the model.
|
| 10 |
+
#
|
| 11 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 12 |
+
# you may not use this file except in compliance with the License.
|
| 13 |
+
# You may obtain a copy of the License at
|
| 14 |
+
#
|
| 15 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 16 |
+
#
|
| 17 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 18 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 19 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 20 |
+
# See the License for the specific language governing permissions and
|
| 21 |
+
# limitations under the License.
|
| 22 |
+
"""HyperCLOVAX model configuration"""
|
| 23 |
+
|
| 24 |
+
from transformers.configuration_utils import PretrainedConfig
|
| 25 |
+
|
| 26 |
+
class HyperCLOVAXConfig(PretrainedConfig):
|
| 27 |
+
r"""
|
| 28 |
+
This is the configuration class to store the configuration of a [`HyperCLOVAXModel`]. It is used to instantiate an HyperCLOVAX
|
| 29 |
+
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
|
| 30 |
+
defaults will yield a similar configuration to that of the HyperCLOVAX.
|
| 31 |
+
|
| 32 |
+
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
|
| 33 |
+
documentation from [`PretrainedConfig`] for more information.
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
Args:
|
| 37 |
+
vocab_size (`int`, *optional*, defaults to 32000):
|
| 38 |
+
Vocabulary size of the HyperCLOVAX model. Defines the number of different tokens that can be represented by the
|
| 39 |
+
`inputs_ids` passed when calling [`HyperCLOVAXModel`]
|
| 40 |
+
hidden_size (`int`, *optional*, defaults to 4096):
|
| 41 |
+
Dimension of the hidden representations.
|
| 42 |
+
intermediate_size (`int`, *optional*, defaults to 11008):
|
| 43 |
+
Dimension of the MLP representations.
|
| 44 |
+
num_hidden_layers (`int`, *optional*, defaults to 32):
|
| 45 |
+
Number of hidden layers in the Transformer decoder.
|
| 46 |
+
num_attention_heads (`int`, *optional*, defaults to 32):
|
| 47 |
+
Number of attention heads for each attention layer in the Transformer decoder.
|
| 48 |
+
num_key_value_heads (`int`, *optional*):
|
| 49 |
+
This is the number of key_value heads that should be used to implement Grouped Query Attention. If
|
| 50 |
+
`num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
|
| 51 |
+
`num_key_value_heads=1` the model will use Multi Query Attention (MQA) otherwise GQA is used. When
|
| 52 |
+
converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
|
| 53 |
+
by meanpooling all the original heads within that group. For more details checkout [this
|
| 54 |
+
paper](https://arxiv.org/pdf/2305.13245.pdf). If it is not specified, will default to
|
| 55 |
+
`num_attention_heads`.
|
| 56 |
+
hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
|
| 57 |
+
The non-linear activation function (function or string) in the decoder.
|
| 58 |
+
max_position_embeddings (`int`, *optional*, defaults to 2048):
|
| 59 |
+
The maximum sequence length that this model might ever be used with.
|
| 60 |
+
initializer_range (`float`, *optional*, defaults to 0.02):
|
| 61 |
+
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
|
| 62 |
+
rms_norm_eps (`float`, *optional*, defaults to 1e-06):
|
| 63 |
+
The epsilon used by the rms normalization layers.
|
| 64 |
+
use_cache (`bool`, *optional*, defaults to `True`):
|
| 65 |
+
Whether or not the model should return the last key/values attentions (not used by all models). Only
|
| 66 |
+
relevant if `config.is_decoder=True`.
|
| 67 |
+
pad_token_id (`int`, *optional*):
|
| 68 |
+
Padding token id.
|
| 69 |
+
bos_token_id (`int`, *optional*, defaults to 1):
|
| 70 |
+
Beginning of stream token id.
|
| 71 |
+
eos_token_id (`int`, *optional*, defaults to 2):
|
| 72 |
+
End of stream token id.
|
| 73 |
+
pretraining_tp (`int`, *optional*, defaults to 1):
|
| 74 |
+
Experimental feature. Tensor parallelism rank used during pretraining. Please refer to [this
|
| 75 |
+
document](https://huggingface.co/docs/transformers/main/perf_train_gpu_many#tensor-parallelism) to
|
| 76 |
+
understand more about it. This value is necessary to ensure exact reproducibility of the pretraining
|
| 77 |
+
results. Please refer to [this issue](https://github.com/pytorch/pytorch/issues/76232).
|
| 78 |
+
tie_word_embeddings (`bool`, *optional*, defaults to `False`):
|
| 79 |
+
Whether to tie weight embeddings
|
| 80 |
+
rope_theta (`float`, *optional*, defaults to 10000.0):
|
| 81 |
+
The base period of the RoPE embeddings.
|
| 82 |
+
rope_scaling (`Dict`, *optional*):
|
| 83 |
+
Dictionary containing the scaling configuration for the RoPE embeddings. NOTE: if you apply new rope type
|
| 84 |
+
and you expect the model to work on longer `max_position_embeddings`, we recommend you to update this value
|
| 85 |
+
accordingly.
|
| 86 |
+
Expected contents:
|
| 87 |
+
`rope_type` (`str`):
|
| 88 |
+
The sub-variant of RoPE to use. Can be one of ['default', 'linear', 'dynamic', 'yarn', 'longrope',
|
| 89 |
+
'llama3'], with 'default' being the original RoPE implementation.
|
| 90 |
+
`factor` (`float`, *optional*):
|
| 91 |
+
Used with all rope types except 'default'. The scaling factor to apply to the RoPE embeddings. In
|
| 92 |
+
most scaling types, a `factor` of x will enable the model to handle sequences of length x *
|
| 93 |
+
original maximum pre-trained length.
|
| 94 |
+
`original_max_position_embeddings` (`int`, *optional*):
|
| 95 |
+
Used with 'dynamic', 'longrope' and 'llama3'. The original max position embeddings used during
|
| 96 |
+
pretraining.
|
| 97 |
+
`attention_factor` (`float`, *optional*):
|
| 98 |
+
Used with 'yarn' and 'longrope'. The scaling factor to be applied on the attention
|
| 99 |
+
computation. If unspecified, it defaults to value recommended by the implementation, using the
|
| 100 |
+
`factor` field to infer the suggested value.
|
| 101 |
+
`beta_fast` (`float`, *optional*):
|
| 102 |
+
Only used with 'yarn'. Parameter to set the boundary for extrapolation (only) in the linear
|
| 103 |
+
ramp function. If unspecified, it defaults to 32.
|
| 104 |
+
`beta_slow` (`float`, *optional*):
|
| 105 |
+
Only used with 'yarn'. Parameter to set the boundary for interpolation (only) in the linear
|
| 106 |
+
ramp function. If unspecified, it defaults to 1.
|
| 107 |
+
`short_factor` (`List[float]`, *optional*):
|
| 108 |
+
Only used with 'longrope'. The scaling factor to be applied to short contexts (<
|
| 109 |
+
`original_max_position_embeddings`). Must be a list of numbers with the same length as the hidden
|
| 110 |
+
size divided by the number of attention heads divided by 2
|
| 111 |
+
`long_factor` (`List[float]`, *optional*):
|
| 112 |
+
Only used with 'longrope'. The scaling factor to be applied to long contexts (<
|
| 113 |
+
`original_max_position_embeddings`). Must be a list of numbers with the same length as the hidden
|
| 114 |
+
size divided by the number of attention heads divided by 2
|
| 115 |
+
`low_freq_factor` (`float`, *optional*):
|
| 116 |
+
Only used with 'llama3'. Scaling factor applied to low frequency components of the RoPE
|
| 117 |
+
`high_freq_factor` (`float`, *optional*):
|
| 118 |
+
Only used with 'llama3'. Scaling factor applied to high frequency components of the RoPE
|
| 119 |
+
attention_bias (`bool`, *optional*, defaults to `False`):
|
| 120 |
+
Whether to use a bias in the query, key, value and output projection layers during self-attention.
|
| 121 |
+
attention_dropout (`float`, *optional*, defaults to 0.0):
|
| 122 |
+
The dropout ratio for the attention probabilities.
|
| 123 |
+
mlp_bias (`bool`, *optional*, defaults to `False`):
|
| 124 |
+
Whether to use a bias in up_proj, down_proj and gate_proj layers in the MLP layers.
|
| 125 |
+
head_dim (`int`, *optional*):
|
| 126 |
+
The attention head dimension. If None, it will default to hidden_size // num_heads
|
| 127 |
+
embedding_multiplier (`float, *optional*, defaults to `None`):
|
| 128 |
+
Multiplier applied to the embedding weights. If `None`, it is equivalent to `1.0`.
|
| 129 |
+
logits_scaling (`float, *optional*, defaults to `None`):
|
| 130 |
+
Scaling factor for logits. If `None`, it is equivalent to `1.0`.
|
| 131 |
+
attention_multiplier (`float, *optional*, defaults to `None`):
|
| 132 |
+
Multiplier applied to the attention weights. If `None`, it is equivalent to `self.head_dim ** -0.5`.
|
| 133 |
+
residual_multiplier (`float, *optional*, defaults to `None`):
|
| 134 |
+
Scaling factor for residual connections. If `None`, it is equivalent to `1.0`.
|
| 135 |
+
use_post_norm (`bool`, *optional*, defaults to `False`):
|
| 136 |
+
Determines whether to apply Peri-Layer Normalization. Set to True to enable this feature.
|
| 137 |
+
|
| 138 |
+
```python
|
| 139 |
+
>>> from transformers import HyperCLOVAXModel, HyperCLOVAXConfig
|
| 140 |
+
|
| 141 |
+
>>> # Initializing a HyperCLOVAX HyperCLOVAX style configuration
|
| 142 |
+
>>> configuration = HyperCLOVAXConfig()
|
| 143 |
+
|
| 144 |
+
>>> # Initializing a model from the HyperCLOVAX style configuration
|
| 145 |
+
>>> model = HyperCLOVAXModel(configuration)
|
| 146 |
+
|
| 147 |
+
>>> # Accessing the model configuration
|
| 148 |
+
>>> configuration = model.config
|
| 149 |
+
```"""
|
| 150 |
+
|
| 151 |
+
model_type = "hyperclovax"
|
| 152 |
+
keys_to_ignore_at_inference = ["past_key_values"]
|
| 153 |
+
|
| 154 |
+
def __init__(
|
| 155 |
+
self,
|
| 156 |
+
vocab_size=32000,
|
| 157 |
+
hidden_size=4096,
|
| 158 |
+
intermediate_size=11008,
|
| 159 |
+
num_hidden_layers=32,
|
| 160 |
+
num_attention_heads=32,
|
| 161 |
+
num_key_value_heads=None,
|
| 162 |
+
hidden_act="silu",
|
| 163 |
+
max_position_embeddings=2048,
|
| 164 |
+
initializer_range=0.02,
|
| 165 |
+
rms_norm_eps=1e-6,
|
| 166 |
+
use_cache=True,
|
| 167 |
+
pad_token_id=None,
|
| 168 |
+
bos_token_id=1,
|
| 169 |
+
eos_token_id=2,
|
| 170 |
+
pretraining_tp=1,
|
| 171 |
+
tie_word_embeddings=False,
|
| 172 |
+
rope_theta=10000.0,
|
| 173 |
+
rope_scaling=None,
|
| 174 |
+
attention_bias=False,
|
| 175 |
+
attention_dropout=0.0,
|
| 176 |
+
mlp_bias=False,
|
| 177 |
+
head_dim=None,
|
| 178 |
+
embedding_multiplier=None, # MuP
|
| 179 |
+
logits_scaling=None, # MuP
|
| 180 |
+
attention_multiplier=None, # MuP
|
| 181 |
+
residual_multiplier=None, # MuP
|
| 182 |
+
use_post_norm=False, # Peri-LN (post-norm)
|
| 183 |
+
auto_map={
|
| 184 |
+
"AutoConfig": "configuration_hyperclovax.HyperCLOVAXConfig",
|
| 185 |
+
"AutoModel": "modeling_hyperclovax.HyperCLOVAXModel",
|
| 186 |
+
"AutoModelForCausalLM": "modeling_hyperclovax.HyperCLOVAXForCausalLM"
|
| 187 |
+
},
|
| 188 |
+
**kwargs,
|
| 189 |
+
):
|
| 190 |
+
self.vocab_size = vocab_size
|
| 191 |
+
self.max_position_embeddings = max_position_embeddings
|
| 192 |
+
self.hidden_size = hidden_size
|
| 193 |
+
self.intermediate_size = intermediate_size
|
| 194 |
+
self.num_hidden_layers = num_hidden_layers
|
| 195 |
+
self.num_attention_heads = num_attention_heads
|
| 196 |
+
|
| 197 |
+
# for backward compatibility
|
| 198 |
+
if num_key_value_heads is None:
|
| 199 |
+
num_key_value_heads = num_attention_heads
|
| 200 |
+
|
| 201 |
+
self.num_key_value_heads = num_key_value_heads
|
| 202 |
+
self.hidden_act = hidden_act
|
| 203 |
+
self.initializer_range = initializer_range
|
| 204 |
+
self.rms_norm_eps = rms_norm_eps
|
| 205 |
+
self.pretraining_tp = pretraining_tp
|
| 206 |
+
self.use_cache = use_cache
|
| 207 |
+
self.rope_theta = rope_theta
|
| 208 |
+
self.rope_scaling = rope_scaling
|
| 209 |
+
self.attention_bias = attention_bias
|
| 210 |
+
self.attention_dropout = attention_dropout
|
| 211 |
+
self.mlp_bias = mlp_bias
|
| 212 |
+
self.head_dim = head_dim if head_dim is not None else self.hidden_size // self.num_attention_heads
|
| 213 |
+
# Validate the correctness of rotary position embeddings parameters
|
| 214 |
+
# BC: if there is a 'type' field, copy it it to 'rope_type'.
|
| 215 |
+
if self.rope_scaling is not None and "type" in self.rope_scaling:
|
| 216 |
+
self.rope_scaling["rope_type"] = self.rope_scaling["type"]
|
| 217 |
+
# rope_config_validation(self)
|
| 218 |
+
|
| 219 |
+
# MuP
|
| 220 |
+
self.embedding_multiplier = embedding_multiplier if embedding_multiplier is not None else 1.0
|
| 221 |
+
self.logits_scaling = logits_scaling if logits_scaling is not None else 1.0
|
| 222 |
+
self.attention_multiplier = attention_multiplier if attention_multiplier is not None else self.head_dim ** -0.5
|
| 223 |
+
self.residual_multiplier = residual_multiplier if residual_multiplier is not None else 1.0
|
| 224 |
+
|
| 225 |
+
# Peri-LN (post-norm)
|
| 226 |
+
self.use_post_norm = use_post_norm
|
| 227 |
+
|
| 228 |
+
super().__init__(
|
| 229 |
+
pad_token_id=pad_token_id,
|
| 230 |
+
bos_token_id=bos_token_id,
|
| 231 |
+
eos_token_id=eos_token_id,
|
| 232 |
+
tie_word_embeddings=tie_word_embeddings,
|
| 233 |
+
auto_map=auto_map,
|
| 234 |
+
**kwargs,
|
| 235 |
+
)
|
generation_config.json
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 100257,
|
| 4 |
+
"eos_token_id": 100257,
|
| 5 |
+
"pad_token_id": 100257,
|
| 6 |
+
"transformers_version": "4.52.3",
|
| 7 |
+
"use_cache": false
|
| 8 |
+
}
|
model-00001-of-00002.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3afed9be25612fd7356ad3846b6a4e3c5095aad115c349f1eaa26ef3839c4663
|
| 3 |
+
size 4979111328
|
model-00002-of-00002.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ab935d2db48a9efcd84250a8a49071a84c6754bdd2d507a92455db6b059506b2
|
| 3 |
+
size 4704195032
|
model.safetensors.index.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|