Views
No views yet
snuh/hari-q3⚠️ These benchmarks are provided for research purposes only and do not imply clinical safety or efficacy.
⚠️ This model is intended for research and educational purposes only and should not be used to make clinical decisions.
1from transformers import AutoTokenizer, AutoModelForCausalLM
2import torch
3
4# Load tokenizer and model
5model_name = "snuh/hari-q3-14b"
6
7model = AutoModelForCausalLM.from_pretrained(
8 model_name,
9 torch_dtype="auto",
10 device_map="auto"
11)
12tokenizer = AutoTokenizer.from_pretrained(model_name)
13
14prompt = '''
15### Instruction:
16당신은 임상 지식을 갖춘 유능하고 신뢰할 수 있는 한국어 기반 의료 어시스턴트입니다.
17사용자의 질문에 대해 정확하고 신중한 임상 추론을 바탕으로 진단 가능성을 제시해 주세요.
18반드시 환자의 연령, 증상, 검사 결과, 통증 부위 등 모든 단서를 종합적으로 고려하여 추론 과정과 진단명을 제시해야 합니다.
19의학적으로 정확한 용어를 사용하되, 필요하다면 일반인이 이해하기 쉬운 용어도 병행해 설명해 주세요.
20
21### Question:
2260세 남성이 복통과 발열을 호소하며 내원하였습니다.
23혈액 검사 결과 백혈구 수치가 상승했고, 우측 하복부 압통이 확인되었습니다.
24가장 가능성이 높은 진단명은 무엇인가요?
25'''.strip()
26
27messages = [
28 {"role": "user", "content": prompt}
29]
30text = tokenizer.apply_chat_template(
31 messages,
32 tokenize=False,
33 add_generation_prompt=True,
34 enable_thinking=True
35)
36model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
37
38generated_ids = model.generate(
39 **model_inputs,
40 max_new_tokens=4096
41)
42generated_ids = [
43 output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
44]
45
46response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
47print(response)@misc{hari-q3,
title = {hari-q3-14b},
url = {https://huggingface.co/snuh/hari-q3-14b},
author = {Healthcare AI Research Institute(HARI) of Seoul National University Hospital(SNUH)},
month = {May},
year = {2025}
}