Instructions to use minsup562/KorMedQwen with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use minsup562/KorMedQwen with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="minsup562/KorMedQwen", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("minsup562/KorMedQwen", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use minsup562/KorMedQwen with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "minsup562/KorMedQwen" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "minsup562/KorMedQwen", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/minsup562/KorMedQwen
- SGLang
How to use minsup562/KorMedQwen with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "minsup562/KorMedQwen" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "minsup562/KorMedQwen", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "minsup562/KorMedQwen" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "minsup562/KorMedQwen", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use minsup562/KorMedQwen with Docker Model Runner:
docker model run hf.co/minsup562/KorMedQwen
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