File size: 5,497 Bytes
c100893 c6b0748 c100893 d7dfada 63bab77 c100893 758d33d c100893 1ffd489 acfc617 c100893 758d33d acfc617 6bb0093 c100893 d2b1968 b13807a 0dca21d 1ffd489 d2b1968 63bab77 0dca21d c6b0748 0dca21d 1ffd489 c6b0748 0dca21d c6b0748 0dca21d c6b0748 0dca21d 1ffd489 c6b0748 1ffd489 c6b0748 1ffd489 6bb0093 1ffd489 c100893 63bab77 c100893 63bab77 c100893 758d33d 6bb0093 c100893 63bab77 6bb0093 63bab77 6bb0093 758d33d c100893 c6b0748 |
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 |
---
library_name: transformers
license: cc-by-nc-4.0
datasets:
- kyujinpy/KOR-OpenOrca-Platypus-v3
language:
- ko
- en
tags:
- Economic
- Finance
---
# Model Details
Model Developers: Sogang University SGEconFinlab(<<https://sc.sogang.ac.kr/aifinlab/>)
### Model Description
This model is a language model specialized in economics and finance. This was learned with various economic/finance-related data.
The data sources are listed below, and we are not releasing the data that we trained on because it was used for research/policy purposes.
If you wish to use the original data, please contact the original author directly for permission to use it.
- **Developed by:** Sogang University SGEconFinlab(<https://sc.sogang.ac.kr/aifinlab/>)
- **License:** cc-by-nc-4.0
- **Base Model:** yanolja/KoSOLAR-10.7B-v0.2(<https://huggingface.co./yanolja/KoSOLAR-10.7B-v0.2>)
## Loading the Model
peft_model_id = "SGEcon/KoSOLAR-10.7B-v0.2_fin_v4"
config = PeftConfig.from_pretrained(peft_model_id)
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_use_double_quant=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.bfloat16
)
model = AutoModelForCausalLM.from_pretrained(config.base_model_name_or_path, quantization_config=bnb_config, device_map={"":0})
model = PeftModel.from_pretrained(model, peft_model_id)
tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
model.eval()
## Conducting Conversation
import re
def gen(x):
inputs = tokenizer(f"### ์ง๋ฌธ: {x}\n\n### ๋ต๋ณ:", return_tensors='pt', return_token_type_ids=False)
# ๋ฐ์ดํฐ๋ฅผ GPU๋ก ์ด๋(์ฌ์ฉ ๊ฐ๋ฅํ ๊ฒฝ์ฐ)
inputs = {k: v.to(device="cuda" if torch.cuda.is_available() else "cpu") for k, v in inputs.items()}
gened = model.generate(
**inputs,
max_new_tokens=256, # ์๋ก ์์ฑํ ํ ํฐ์ ์ต๋ ๊ฐ์
early_stopping=True,
num_return_sequences=1, # ํ๋์ ๋ต๋ณ๋ง ์์ฑ
do_sample=True, # ๋ค์ํ ๋ต๋ณ ์์ฑ์ ์ํด ์ํ๋ง ํ์ฑํ
eos_token_id=tokenizer.eos_token_id, # EOS ํ ํฐ ID ์ฌ์ฉ
temperature=0.9, # ์์ฑ ๋ค์์ฑ ์กฐ์ ์ ์ํ ์จ๋ ์ค์
top_p=0.8, # nucleus sampling์์ ์ฌ์ฉํ p ๊ฐ
top_k=50 # top-k sampling์์ ์ฌ์ฉํ k ๊ฐ
)
# ์์ฑ๋ ์ํ์ค๋ฅผ ๋์ฝ๋ํ์ฌ ์ถ๋ ฅ ํ
์คํธ๋ก ๋ณํ
decoded = tokenizer.decode(gened[0], skip_special_tokens=True).strip()
# "### ๋ต๋ณ:" ๋ฌธ์์ด ์ดํ์ ํ
์คํธ๋ง ์ถ์ถ
answer_start_idx = decoded.find("### ๋ต๋ณ:") + len("### ๋ต๋ณ:")
complete_answer = decoded[answer_start_idx:].strip()
# ์ฒซ ๋ฒ์งธ ๊ตฌ๋์ (. ? !)์ ์ฐพ์์ ๊ทธ ๋ถ๋ถ๊น์ง๋ง ์ถ์ถ
match = re.search(r"[\.\?\!][^\.\?\!]*$", complete_answer)
if match:
complete_answer = complete_answer[:match.end()].strip()
return complete_answer
## Training Details
First, we loaded the base model quantized to 4 bits. It can significantly reduce the amount of memory required to store the model's weights and intermediate computation results, which is beneficial for deploying models in environments with limited memory resources. It can also provide faster inference speeds.
Then,
### Training Data
1. ํ๊ตญ์ํ: ๊ฒฝ์ ๊ธ์ต์ฉ์ด 700์ (<https://www.bok.or.kr/portal/bbs/B0000249/view.do?nttId=235017&menuNo=200765>)
2. ๊ธ์ต๊ฐ๋
์: ๊ธ์ต์๋น์ ์ ๋ณด ํฌํธ ํ์ธ ๊ธ์ต์ฉ์ด์ฌ์ (<https://fine.fss.or.kr/fine/fnctip/fncDicary/list.do?menuNo=900021>)
3. KDI ๊ฒฝ์ ์ ๋ณด์ผํฐ: ์์ฌ ์ฉ์ด์ฌ์ (<https://eiec.kdi.re.kr/material/wordDic.do>)
4. ํ๊ตญ๊ฒฝ์ ์ ๋ฌธ/ํ๊ฒฝ๋ท์ปด: ํ๊ฒฝ๊ฒฝ์ ์ฉ์ด์ฌ์ (<https://terms.naver.com/list.naver?cid=42107&categoryId=42107>), ์ค๋์ TESAT(<https://www.tesat.or.kr/bbs.frm.list/tesat_study?s_cateno=1>), ์ค๋์ ์ฃผ๋์ด TESAT(<https://www.tesat.or.kr/bbs.frm.list/tesat_study?s_cateno=5>), ์๊ธ์๊ธํ๊ฒฝ(<https://sgsg.hankyung.com/tesat/study>)
5. ์ค์๋ฒค์ฒ๊ธฐ์
๋ถ/๋ํ๋ฏผ๊ตญ์ ๋ถ: ์ค์๋ฒค์ฒ๊ธฐ์
๋ถ ์ ๋ฌธ์ฉ์ด(<https://terms.naver.com/list.naver?cid=42103&categoryId=42103>)
6. ๊ณ ์ฑ์ผ/๋ฒ๋ฌธ์ถํ์ฌ: ํ๊ณยท์ธ๋ฌด ์ฉ์ด์ฌ์ (<https://terms.naver.com/list.naver?cid=51737&categoryId=51737>)
7. ๋งจํ์ ๊ฒฝ์ ํ 8ํ Word Index
8. yanolja/KoSOLAR-10.7B-v0.2(<yanolja/KoSOLAR-10.7B-v0.2>)
### Training Procedure
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
#### Training Hyperparameters
|Hyperparameter|SGEcon/KoSOLAR-10.7B-v0.2_fin_v4|
|------|---|
|Lora Method|Lora|
|load in 4 bit|True|
|learning rate|1e-5|
|lr scheduler|linear|
|lora alpa|16|
|lora rank|16|
|lora dropout|0.05|
|optim|paged_adamw_32bit|
|target_modules|q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj, lm_head|
## Evaluation
<!-- This section describes the evaluation protocols and provides the results. -->
### Testing Data, Factors & Metrics
#### Testing Data
<!-- This should link to a Dataset Card if possible. -->
[More Information Needed]
### Results
[More Information Needed]
#### Summary
## Citation [optional]
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. --> |