---
library_name: transformers
license: cc-by-nc-4.0
datasets:
- kyujinpy/KOR-OpenOrca-Platypus-v3
language:
- ko
- en
tags:
- Economic
- Finance
base_model: davidkim205/komt-mistral-7b-v1
---
# Model Details
Model Developers: Sogang University SGEconFinlab(<)
## 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()
- **License:** cc-by-nc-4.0
- **Base Model:** davidkim205/komt-mistral-7b-v1()
## Loading the Model
peft_model_id = "SGEcon/komt-mistral-7b-v1_fin_v5"
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()
streamer = TextStreamer(tokenizer)
## Conducting Conversation
def gen(x):
generation_config = GenerationConfig(
temperature=0.9,
top_p=0.8,
top_k=50,
max_new_tokens=256,
early_stopping=True,
do_sample=True,
)
q = f"[INST]{x} [/INST]"
gened = model.generate(
**tokenizer(
q,
return_tensors='pt',
return_token_type_ids=False
).to('cuda'),
generation_config=generation_config,
pad_token_id=tokenizer.eos_token_id,
eos_token_id=tokenizer.eos_token_id,
streamer=streamer,
)
result_str = tokenizer.decode(gened[0])
# 입력 질문과 "[INST]" 및 "[/INST]" 태그 제거
input_question_with_tags = f"[INST]{x} [/INST]"
result_str = result_str.replace(input_question_with_tags, "").strip()
# "" 및 "" 태그 제거
result_str = result_str.replace("", "").replace("", "").strip()
return result_str
## Training Details
- We train our model with PEFT.
PEFT is a technique that does not tune all parameters of a model during fine-tuning, but only a small subset of parameters.
By tuning only a few parameters while leaving others fixed, the model is less likely to suffer from catastrophic forgetting, where the model forgets previously learned tasks when it learns new ones.
This significantly reduces computation and storage costs.
- We use QLora to train the base model.
Quantized Low Rank Adapters (QLoRA) is an efficient technique that uses 4-bit quantized pre-trained language models to fine-tune 65 billion parameter models on a 48 GB GPU while significantly reducing memory usage.
The method uses NormalFloat 4-bit (NF4), a new data type that is theoretically optimal for normally distributed weights; Double Quantization, which further quantizes quantization constants to reduce average memory usage; and Paged Optimizers, which manage memory spikes during mini-batch processing, to increase memory efficiency without sacrificing performance.
- Also, we performed instruction tuning using the data that we collected and the kyujinpy/KOR-OpenOrca-Platypus-v3 dataset on the hugging face.
Instruction tuning is learning in a supervised learning format that uses instructions and input data together as input and output data as a pair.
In other words, instruction tuning involves fine-tuning a pre-trained model for a specific task or set of tasks, where the model is taught to follow specific instructions or guidelines.
Instruction tuning is a type of Supervised Fine-tuning (SFT) that aims to improve the generality and adaptability of a model by introducing an additional dimension that enables the model to understand and follow specific instructions.
## Training Data
1. 한국은행: 경제금융용어 700선()
2. 금융감독원: 금융소비자 정보 포털 파인 금융용어사전()
3. KDI 경제정보센터: 시사 용어사전()
4. 한국경제신문/한경닷컴: 한경경제용어사전(), 오늘의 TESAT(), 오늘의 주니어 TESAT(), 생글생글한경()
5. 중소벤처기업부/대한민국정부: 중소벤처기업부 전문용어()
6. 고성삼/법문출판사: 회계·세무 용어사전()
7. 맨큐의 경제학 8판 Word Index
8. kyujinpy/KOR-OpenOrca-Platypus-v3()
At the request of the original author, it is not to be used for commercial purposes. Therefore, it is licensed under the license CC-BY-NC-4.0.
The copyright of the data used belongs to the original author, so please contact the original author when using it.
## Training Hyperparameters
|Hyperparameter|SGEcon/komt-mistral-7b-v1_fin_v5|
|------|---|
|Lora Method|Lora|
|load in 4 bit|True|
|learning rate|1e-6|
|lora alpa|8|
|lora rank|32|
|lora dropout|0.05|
|optim|adamw_torch|
|target_modules|o_proj, q_proj, up_proj, down_proj, gate_proj, k_proj, v_proj, lm_head|
## License
The language identification model is distributed under the Creative Commons Attribution-NonCommercial 4.0 International Public License.
## Example
> 중앙은행의 역할에 대해서 설명해줄래?
>> 중앙은행은 국가 경제의 안정을 유지하기 위해 국가의 통화 발행, 은행 업무 감독, 대출 조절 등의 중요한 역할을 수행하는 금융 기관이다. 중앙은행은 국가의 통화 발행 조절을 통해 물가 상승을 억제하고, 이를 통해 가격 안정성을 유지하고자 한다. 또한, 중앙은행은 대출 조절을 통해 금리를 조절하여 자금 조달 시장에 적절한 금리 수준을 유지하고, 이를 통해 경제 활동을 적절히 조절할 수 있다.