Edit model card

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.

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()

    # "<s>" ๋ฐ "</s>" ํƒœ๊ทธ ์ œ๊ฑฐ
    result_str = result_str.replace("<s>", "").replace("</s>", "").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์„ (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. kyujinpy/KOR-OpenOrca-Platypus-v3(https://huggingface.co/datasets/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

์ค‘์•™์€ํ–‰์˜ ์—ญํ• ์— ๋Œ€ํ•ด์„œ ์„ค๋ช…ํ•ด์ค„๋ž˜?

์ค‘์•™์€ํ–‰์€ ๊ตญ๊ฐ€ ๊ฒฝ์ œ์˜ ์•ˆ์ •์„ ์œ ์ง€ํ•˜๊ธฐ ์œ„ํ•ด ๊ตญ๊ฐ€์˜ ํ†ตํ™” ๋ฐœํ–‰, ์€ํ–‰ ์—…๋ฌด ๊ฐ๋…, ๋Œ€์ถœ ์กฐ์ ˆ ๋“ฑ์˜ ์ค‘์š”ํ•œ ์—ญํ• ์„ ์ˆ˜ํ–‰ํ•˜๋Š” ๊ธˆ์œต ๊ธฐ๊ด€์ด๋‹ค. ์ค‘์•™์€ํ–‰์€ ๊ตญ๊ฐ€์˜ ํ†ตํ™” ๋ฐœํ–‰ ์กฐ์ ˆ์„ ํ†ตํ•ด ๋ฌผ๊ฐ€ ์ƒ์Šน์„ ์–ต์ œํ•˜๊ณ , ์ด๋ฅผ ํ†ตํ•ด ๊ฐ€๊ฒฉ ์•ˆ์ •์„ฑ์„ ์œ ์ง€ํ•˜๊ณ ์ž ํ•œ๋‹ค. ๋˜ํ•œ, ์ค‘์•™์€ํ–‰์€ ๋Œ€์ถœ ์กฐ์ ˆ์„ ํ†ตํ•ด ๊ธˆ๋ฆฌ๋ฅผ ์กฐ์ ˆํ•˜์—ฌ ์ž๊ธˆ ์กฐ๋‹ฌ ์‹œ์žฅ์— ์ ์ ˆํ•œ ๊ธˆ๋ฆฌ ์ˆ˜์ค€์„ ์œ ์ง€ํ•˜๊ณ , ์ด๋ฅผ ํ†ตํ•ด ๊ฒฝ์ œ ํ™œ๋™์„ ์ ์ ˆํžˆ ์กฐ์ ˆํ•  ์ˆ˜ ์žˆ๋‹ค.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference API
Unable to determine this modelโ€™s pipeline type. Check the docs .

Model tree for SGEcon/komt-mistral-7b-v1_fin_v5

Finetuned
(2)
this model

Dataset used to train SGEcon/komt-mistral-7b-v1_fin_v5