Intro

This is a self-created project to finetune Qwen 7B chat model to Korean Med QA dataset (3104) Since the dataset is quite small, it was mixed with kollm-conversation dataset (5000) Used total of 8104 datapoints.

Compared to original Qwen model, KorMedQwen performs about 2% better. Models were evaluated using 200 test data. Original Qwen model got 19.5% correct while KorMedQwen got 21% correct.

Personally I think if we perform continuous pretraining on medical data then finetune with a lot more Korean Med QA data, it will perform a lot better.

QuickStart

from transformers import AutoModelForCausalLM, AutoTokenizer

# Note: The default behavior now has injection attack prevention off.
tokenizer = AutoTokenizer.from_pretrained("minsup562/KorMedQwen", trust_remote_code=True)

# use bf16
# model = AutoModelForCausalLM.from_pretrained("minsup562/KorMedQwen", device_map="auto", trust_remote_code=True, bf16=True).eval()
# use fp16
# model = AutoModelForCausalLM.from_pretrained("minsup562/KorMedQwen", device_map="auto", trust_remote_code=True, fp16=True).eval()
# use cpu only
# model = AutoModelForCausalLM.from_pretrained("minsup562/KorMedQwen", device_map="cpu", trust_remote_code=True).eval()
# use auto mode, automatically select precision based on the device.
model = AutoModelForCausalLM.from_pretrained("minsup562/KorMedQwen", device_map="auto", trust_remote_code=True).eval()

query = """๋‹ค์Œ ์งˆ๋ฌธ๊ณผ ๋ณด๊ธฐ๋“ค์„ ๋ณด๊ณ  ๊ฐ€์žฅ ์•Œ๋งž์€ ๋ณด๊ธฐ๋ฅผ ๊ณจ๋ผ์„œ ์„ค๋ช…์—†์ด ๋‹ต๋งŒ ๋งํ•ด.
  14์„ธ ์—ฌํ•™์ƒ์ด ์†Œํ™”๋ถˆ๋Ÿ‰๊ณผ ๋ณต๋ถ€ํŒฝ๋งŒ์œผ๋กœ ์–ด๋จธ๋‹ˆ์™€ ํ•จ๊ป˜ ๋ณ‘์›์— ์™”๋‹ค. ๋Œ€ํ•™์ƒ์ธ ๋‚จ์ž์นœ๊ตฌ์™€ ์„ฑ๊ด€๊ณ„๋ฅผ ๊ทœ์น™์ ์œผ๋กœ ํ•˜๊ณ  ์žˆ์œผ๋ฉฐ ์›”๊ฒฝ์ด 3๊ฐœ์›”์งธ ์—†๋‹ค๊ณ  ํ•œ๋‹ค.
  ์†Œ๋ณ€ ์ž„์‹ ๋ฐ˜์‘๊ฒ€์‚ฌ ๊ฒฐ๊ณผ๋Š” ์–‘์„ฑ์ด๋‹ค. ์—ฌํ•™์ƒ์€ ์ง„๋ฃŒ์‹ค ๋ฐ–์— ์žˆ๋Š” ์–ด๋จธ๋‹ˆ์—๊ฒŒ ์ž„์‹  ์‚ฌ์‹ค์€ ์ ˆ๋Œ€ ๋งํ•˜์ง€ ๋ง๊ณ  ๊ทธ๋ƒฅ ์žฅ์—ผ์ด๋ผ๊ณ  ๋งํ•ด ๋‹ฌ๋ผ๊ณ  ๋ถ€ํƒ์„ ํ•œ๋‹ค.
  ์ž„์‹  ์‚ฌ์‹ค ๊ณ ์ง€์— ๋Œ€ํ•œ ์กฐ์น˜๋Š”?
  A: ์ฆ‰์‹œ ์–ด๋จธ๋‹ˆ๋ฅผ ๋ถˆ๋Ÿฌ ๊ณ ์ง€ํ•จ B: ๋‚˜์ค‘์— ์–ด๋จธ๋‹ˆ์—๊ฒŒ ์ „ํ™”๋กœ ๊ณ ์ง€ํ•จ
  C: ์ผ๋‹จ, ์–ด๋จธ๋‹ˆ์™€ ์ƒ์˜ํ•˜๋„๋ก ํ•™์ƒ์„ ์„ค๋“ํ•จ D: ํ•™์ƒ์˜ ๋ถ€ํƒ๋Œ€๋กœ ์žฅ์—ผ์ด๋ผ๊ณ  ๋งํ•ด์คŒ
  E: ๋‚จ์ž์นœ๊ตฌ์™€ ๋‹ค์‹œ ๋ฐฉ๋ฌธํ•˜๋„๋ก ๊ถŒ์œ ํ•จ"""

response, history = model.chat(tokenizer, query, history=None)
print(response)
Downloads last month
17
Safetensors
Model size
8B params
Tensor type
BF16
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for minsup562/KorMedQwen

Quantizations
1 model