SGEcon commited on
Commit
1ffd489
โ€ข
1 Parent(s): d7dfada

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +61 -31
README.md CHANGED
@@ -10,14 +10,14 @@ Model Developers: Sogang University SGEconFinlab
10
 
11
  ### Model Description
12
 
13
- This model is a language model specialized in economics and finance. This was learned with various economic/finance-related data such as ํ•œ๊ตญ์€ํ–‰ ๊ฒฝ์ œ ์šฉ์–ด, ๊ธˆ์œต์šฉ์–ด์‚ฌ์ „, KDI์‹œ์‚ฌ์šฉ์–ด์‚ฌ์ „, ํšŒ๊ณ„,์„ธ๋ฌด์šฉ์–ด์‚ฌ์ „, ์ค‘์†Œ๊ธฐ์—…์ฒญ์ „๋ฌธ์šฉ์–ด์‚ฌ์ „, ํ•œ๊ฒฝ๊ฒฝ์ œ์šฉ์–ด์‚ฌ์ „, ๋งจํ๊ฒฝ์ œํ•™, TESAT ์‹œ์‚ฌ ์šฉ์–ด ๋”ฐ๋ผ์žก๊ธฐ, ๋งจํ๊ฒฝ์ œํ•™, ์ƒ๊ธ€์ƒ๊ธ€ ํ•œ๊ฒฝ, ์˜ค๋Š˜์˜ TESAT, ํ•œ๊ฒฝ์ฃผ๋‹ˆ์–ด TESAT.
14
- The data source is listed below, and since the data was used for research/policy purposes, we do not wish to disclose the trained data. If you wish to use it, please contact the original author for permission to use it.
 
15
 
16
- - **Developed by:** Sogang University SGEconFinlab
17
- - **Model type:** [More Information Needed]
18
- - **Language(s) (NLP):** [More Information Needed]
19
- - **License:** [More Information Needed]
20
- - **Base Model:** yanolja/KoSOLAR-10.7B-v0.2
21
 
22
  ### Model Sources [optional]
23
 
@@ -38,32 +38,62 @@ The data source is listed below, and since the data was used for research/policy
38
  [More Information Needed]
39
 
40
 
41
- [More Information Needed]
42
-
43
- ### Out-of-Scope Use
44
-
45
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
46
-
47
- [More Information Needed]
48
-
49
- ## Bias, Risks, and Limitations
50
-
51
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
52
-
53
- [More Information Needed]
54
-
55
- ### Recommendations
56
-
57
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
58
-
59
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
60
-
61
  ## How to Get Started with the Model
62
 
63
- Use the code below to get started with the model.
64
-
65
- [More Information Needed]
66
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  ## Training Details
68
 
69
  ### Training Data
 
10
 
11
  ### Model Description
12
 
13
+ This model is a language model specialized in economics and finance. This was learned with various economic/finance-related data.
14
+ The data sources are listed below, and we are not releasing the data we trained on because it was used for research/policy purposes.
15
+ If you wish to use the original data rather than our training data, please contact the original author directly for permission to use it.
16
 
17
+ - **Developed by:** [Sogang University SGEconFinlab]
18
+ - **Language(s) (NLP):** [Ko/En]
19
+ - **License:** [apache-2.0]
20
+ - **Base Model:** [yanolja/KoSOLAR-10.7B-v0.2]
 
21
 
22
  ### Model Sources [optional]
23
 
 
38
  [More Information Needed]
39
 
40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  ## How to Get Started with the Model
42
 
43
+ peft_model_id = "SGEcon/KoSOLAR-10.7B-v0.2_fin_v4"
44
+ config = PeftConfig.from_pretrained(peft_model_id)
45
+ bnb_config = BitsAndBytesConfig(
46
+ load_in_4bit=True,
47
+ bnb_4bit_use_double_quant=True,
48
+ bnb_4bit_quant_type="nf4",
49
+ bnb_4bit_compute_dtype=torch.bfloat16
50
+ )
51
+ model = AutoModelForCausalLM.from_pretrained(config.base_model_name_or_path, quantization_config=bnb_config, device_map={"":0})
52
+ model = PeftModel.from_pretrained(model, peft_model_id)
53
+ tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
54
+ model.eval()
55
+
56
+
57
+ import re
58
+
59
+ def gen(x):
60
+ inputs = tokenizer(f"### ์งˆ๋ฌธ: {x}\n\n### ๋‹ต๋ณ€:", return_tensors='pt', return_token_type_ids=False)
61
+
62
+ # ๋ฐ์ดํ„ฐ๋ฅผ GPU๋กœ ์ด๋™(์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ๊ฒฝ์šฐ)
63
+ inputs = {k: v.to(device="cuda" if torch.cuda.is_available() else "cpu") for k, v in inputs.items()}
64
+
65
+ gened = model.generate(
66
+ **inputs,
67
+ max_new_tokens=256,
68
+ early_stopping=True,
69
+ num_return_sequences=4, # 4๊ฐœ์˜ ๋‹ต๋ณ€์„ ์ƒ์„ฑํ•˜๋„๋ก ์„ค์ •(๋‹ต๋ณ€ ๊ฐœ์ˆ˜ ์„ค์ • ๊ฐ€๋Šฅ)
70
+ do_sample=True,
71
+ eos_token_id=tokenizer.eos_token_id, # EOS ํ† ํฐ ID ์‚ฌ์šฉ
72
+ temperature=0.9,
73
+ top_p=0.8,
74
+ top_k=50
75
+ )
76
+
77
+ complete_answers = []
78
+ for gen_seq in gened:
79
+ decoded = tokenizer.decode(gen_seq, skip_special_tokens=True).strip()
80
+
81
+ # "### ๋‹ต๋ณ€:" ๋ฌธ์ž์—ด ์ดํ›„์˜ ํ…์ŠคํŠธ๋งŒ ์ถ”์ถœ
82
+ first_answer_start_idx = decoded.find("### ๋‹ต๋ณ€:") + len("### ๋‹ต๋ณ€:")
83
+ temp_answer = decoded[first_answer_start_idx:].strip()
84
+
85
+ # ๋‘ ๋ฒˆ์งธ "### ๋‹ต๋ณ€:" ๋ฌธ์ž์—ด ์ด์ „๊นŒ์ง€์˜ ํ…์ŠคํŠธ๋งŒ ์ถ”์ถœ
86
+ second_answer_start_idx = temp_answer.find("### ๋‹ต๋ณ€:")
87
+ if second_answer_start_idx != -1:
88
+ complete_answer = temp_answer[:second_answer_start_idx].strip()
89
+ else:
90
+ complete_answer = temp_answer # ๋‘ ๋ฒˆ์งธ "### ๋‹ต๋ณ€:"์ด ์—†๋Š” ๊ฒฝ์šฐ ์ „์ฒด ๋‹ต๋ณ€ ๋ฐ˜ํ™˜
91
+
92
+ complete_answers.append(complete_answer)
93
+
94
+ return complete_answers
95
+
96
+
97
  ## Training Details
98
 
99
  ### Training Data