davidkim205 commited on
Commit
390e33b
Β·
1 Parent(s): a815363

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +83 -11
README.md CHANGED
@@ -38,20 +38,92 @@ korean multi-task instruction dataset
38
  - CUDA Version: 12.2
39
 
40
  ## Training
41
- Refer github
42
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  ## Evaluation
44
 
45
- For objective model evaluation, we initially used EleutherAI's lm-evaluation-harness but obtained unsatisfactory results. Consequently, we conducted evaluations using ChatGPT, a widely used model, as described in [Self-Alignment with Instruction Backtranslation](https://arxiv.org/pdf/2308.06502.pdf) and [Three Ways of Using Large Language Models to Evaluate Chat](https://arxiv.org/pdf/2308.06259.pdf) .
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
- | model | score | average score | % |
48
- | ------------------------------ | ------- |---------------|------------|
49
- | gpt-3.5-turbo | 147 | 3.97 | 79.45% |
50
- | WizardLM-13B-V1.2 | 96 | 2.59 | 51.89% |
51
- | Llama-2-7b-chat-hf | 67 | 1.81 | 36.21% |
52
- | Llama-2-13b-chat-hf | 73 | 1.91 | 38.37% |
53
- | **komt-llama2-7b-v1 (ours)** | **117** | **3.16** | **63.24%** |
54
- | **komt-llama2-13b-v1 (ours)** | **129** | **3.48** | **69.72%** |
55
 
56
  ------------------------------------------------
57
  # Original model card: Meta's Llama 2 7B-chat
 
38
  - CUDA Version: 12.2
39
 
40
  ## Training
41
+ Refer https://github.com/davidkim205/komt
42
+
43
+ ## Usage
44
+ ```
45
+ from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
46
+ from peft import PeftModel, PeftConfig
47
+ from transformers import TextStreamer, GenerationConfig
48
+
49
+
50
+ model='davidkim205/komt-llama2-13b-v1'
51
+ peft_model_name = 'davidkim205/komt-llama2-13b-v1-lora'
52
+ config = PeftConfig.from_pretrained(peft_model_name)
53
+ bnb_config = BitsAndBytesConfig(
54
+ load_in_4bit=True,
55
+ bnb_4bit_use_double_quant=True,
56
+ bnb_4bit_quant_type="nf4",
57
+ bnb_4bit_compute_dtype=torch.bfloat16
58
+ )
59
+ config.base_model_name_or_path =model
60
+ model = AutoModelForCausalLM.from_pretrained(config.base_model_name_or_path, quantization_config=bnb_config, device_map="auto")
61
+ model = PeftModel.from_pretrained(model, peft_model_name)
62
+ tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
63
+ streamer = TextStreamer(tokenizer)
64
+
65
+ def gen(x):
66
+ generation_config = GenerationConfig(
67
+ temperature=0.8,
68
+ top_p=0.8,
69
+ top_k=100,
70
+ max_new_tokens=512,
71
+ early_stopping=True,
72
+ do_sample=True,
73
+ )
74
+ q = f"### instruction: {x}\n\n### Response: "
75
+ gened = model.generate(
76
+ **tokenizer(
77
+ q,
78
+ return_tensors='pt',
79
+ return_token_type_ids=False
80
+ ).to('cuda'),
81
+ generation_config=generation_config,
82
+ pad_token_id=tokenizer.eos_token_id,
83
+ eos_token_id=tokenizer.eos_token_id,
84
+ streamer=streamer,
85
+ )
86
+ result_str = tokenizer.decode(gened[0])
87
+
88
+ start_tag = f"\n\n### Response: "
89
+ start_index = result_str.find(start_tag)
90
+
91
+ if start_index != -1:
92
+ result_str = result_str[start_index + len(start_tag):].strip()
93
+ return result_str
94
+
95
+ print(gen('μ œμ£Όλ„λ₯Ό 1λ°•2일둜 혼자 μ—¬ν–‰ν•˜λ €κ³  ν•˜λŠ”λ° μ—¬ν–‰ μ½”μŠ€λ₯Ό λ§Œλ“€μ–΄μ€˜'))
96
+ ```
97
+ output
98
+ ```
99
+ ### Response: μ œμ£Όλ„λ₯Ό 1λ°•2일둜 혼자 μ—¬ν–‰ν•˜λ €λ©΄ λ‹€μŒκ³Ό 같은 μ—¬ν–‰ μ½”μŠ€λ₯Ό λ§Œλ“€μ–΄ κ³„νšν•  수 μžˆμŠ΅λ‹ˆλ‹€:
100
+
101
+ 1일차:
102
+ - μ•„μΉ¨: μ œμ£Όλ„μ˜ μ•„λ¦„λ‹€μš΄ 해변을 κ΅¬κ²½ν•˜κΈ° μœ„ν•΄ 해변에 λ„μ°©ν•˜μ„Έμš”. μΌμΆœμ„ κ°μƒν•˜λ©° μžμ—°μ˜ 아름닀움을 λ§Œλ½ν•˜μ„Έμš”.
103
+ - μ˜€ν›„: μ œμ£Όλ„μ˜ λŒ€ν‘œμ μΈ 관광지인 ν•œλΌμ‚°μ„ νƒν—˜ν•˜μ„Έμš”. λ“±μ‚°λ‘œλ₯Ό 따라 μ˜¬λΌκ°€λ©΄μ„œ 경치λ₯Ό 즐기고 μ„€λͺ…을 λ“£μœΌλ©° μ‰¬μš΄ 산책을 μ¦κΈ°μ„Έμš”.
104
+ - 저녁: μ œμ£Όλ„μ˜ λ§›μžˆλŠ” μŒμ‹μ μ—μ„œ 저녁을 λ³΄λ‚΄μ„Έμš”. μ‹ μ„ ν•œ ν•΄μ‚°λ¬Όκ³Ό ν–₯μ‹ λ£Œλ‘œ λ§Œλ“  μŒμ‹μ„ λ§›λ³΄λŠ” 것은 μ œμ£Όλ„ μ—¬ν–‰μ˜ μ™„λ²½ν•œ κ²½ν—˜μ΄ 될 κ²ƒμž…λ‹ˆλ‹€.
105
+
106
+ 2일차:
107
+ - μ•„μΉ¨: ν•œλΌμ‚° μΌλŒ€λ₯Ό νƒν—˜ν•˜κΈ° μœ„ν•΄ ν•œλΌμ‚° μΌ€μ΄ν”„λ‘œ μ΄λ™ν•˜μ„Έμš”. 이 μΌ€μ΄ν”„λŠ” 등산을 μ¦κΈ°λŠ” μ‚¬λžŒλ“€μ—κ²Œ 졜적의 μ„ νƒμž…λ‹ˆλ‹€.
108
+
109
+ ```
110
  ## Evaluation
111
 
112
+ | model | score | average(0~5) | percentage |
113
+ | --------------------------------------- | ------- | ------------ | ---------- |
114
+ | gpt-3.5-turbo(close) | 147 | 3.97 | 79.45% |
115
+ | naver Cue(close) | 140 | 3.78 | 75.67% |
116
+ | clova X(close) | 136 | 3.67 | 73.51% |
117
+ | WizardLM-13B-V1.2(open) | 96 | 2.59 | 51.89% |
118
+ | Llama-2-7b-chat-hf(open) | 67 | 1.81 | 36.21% |
119
+ | Llama-2-13b-chat-hf(open) | 73 | 1.91 | 38.37% |
120
+ | nlpai-lab/kullm-polyglot-12.8b-v2(open) | 70 | 1.89 | 37.83% |
121
+ | kfkas/Llama-2-ko-7b-Chat(open) | 96 | 2.59 | 51.89% |
122
+ | beomi/KoAlpaca-Polyglot-12.8B(open) | 100 | 2.70 | 54.05% |
123
+ | **komt-llama2-7b-v1 (open)(ours)** | **117** | **3.16** | **63.24%** |
124
+ | **komt-llama2-13b-v1 (open)(ours)** | **129** | **3.48** | **69.72%** |
125
+
126
 
 
 
 
 
 
 
 
 
127
 
128
  ------------------------------------------------
129
  # Original model card: Meta's Llama 2 7B-chat