1import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM
3from peft import PeftModel
4
5base_model_id = "LLM360/K2-Think"
6adapter_id = "SutanRifkyt/K2-Inhale"
7
8tokenizer = AutoTokenizer.from_pretrained(
9 base_model_id,
10 use_fast=False,
11 trust_remote_code=False
12)
13
14model = AutoModelForCausalLM.from_pretrained(
15 base_model_id,
16 torch_dtype=torch.bfloat16,
17 device_map="auto",
18 trust_remote_code=False
19)
20
21model = PeftModel.from_pretrained(
22 model,
23 adapter_id,
24 torch_dtype=torch.bfloat16,
25 device_map="auto",
26)
27
28prompt = """<|user|>:
29Explain this chest CT finding in simple language for the patient, assess how concerning it is for lung cancer, and say what should happen next.
30
31Clinical findings:
32Spiculated 1.8 cm nodule in the right upper lobe with irregular margins and increased FDG uptake on PET.
33<|assistant|>:
34"""
35
36inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
37
38with torch.no_grad():
39 output = model.generate(
40 **inputs,
41 max_new_tokens=300,
42 temperature=0.2,
43 do_sample=True,
44 )
45
46print(tokenizer.decode(output[0], skip_special_tokens=True))
47⚡ Quantized version
48
49For easier inference on smaller GPUs / single consumer cards, a quantized export is included under quantized/.
50
51quantized/ is an experimental merged model snapshot intended for local testing / demo.
52Quality may be lower vs full base+LoRA above.
53
54Basic usage (example, adjust to your runtime):
55
56import torch
57from transformers import AutoTokenizer, AutoModelForCausalLM
58
59quantized_id = "SutanRifkyt/K2-Inhale/quantized"
60
61tokenizer = AutoTokenizer.from_pretrained(
62 quantized_id,
63 use_fast=False,
64 trust_remote_code=False
65)
66
67model = AutoModelForCausalLM.from_pretrained(
68 quantized_id,
69 torch_dtype=torch.float16,
70 device_map="auto",
71 trust_remote_code=False
72)
73
74
75Note: If you see GGUF / AWQ / bitsandbytes entries, load with the correct loader for that format.
76
77📚 Training data (high-level)
78
79~8k supervised instruction-style pairs constructed from:
80
81public lung CT and PET/CT descriptions (incl. TCIA-like oncology cohorts),
82
83synthetic expansions of impression/assessment text,
84
85staged "what happens next" counseling scripts.
86
87Each sample looks like:
88
89instruction: "Explain this finding for the patient, include cancer concern level, and next step"
90
91input: actual CT/PET-CT style text (nodule size, FDG uptake, etc.)
92
93output: step-by-step reasoning and final recommendation in plain language.
94
95🚨 Safety & limitations
96
97This model is for triage / education, not diagnosis.
98
99It may sound confident even when uncertain.
100
101It has not been clinically validated.
102
103Always involve a radiologist / oncologist for real decisions.
104
105📚 Citation / credit
106
107Base model LLM360/K2-Think is released by the LLM360 team.
108This repository only publishes LoRA/PEFT adapter weights and an optional quantized snapshot, fine-tuned by Sutan Rifky Tedjasukmana (@SutanRifkyt) for lung imaging triage.
109
110Li, P., Wang, S., Li, T., Lu, J., HuangFu, Y., & Wang, D. (2020). A Large-Scale CT and PET/CT Dataset for Lung Cancer Diagnosis (Lung-PET-CT-Dx) [Data set].
111The Cancer Imaging Archive. https://doi.org/10.7937/TCIA.2020.NNC2-0461
112
113S. Montagna et al., "LLM-based Solutions for Healthcare Chatbots: a Comparative Analysis," 2024 IEEE International Conference on Pervasive Computing and Communications Workshops and other Affiliated Events (PerCom Workshops), Biarritz, France, 2024,
114pp. 346-351, doi: 10.1109/PerComWorkshops59983.2024.10503257. keywords: {Pervasive computing;Privacy;Filtering;Conferences;
115Computational modeling;Medical services;Chatbots;Large Language Model;Medical Chatbot;Chronic Disease Management},
116
117Baharoon, M., Luo, L., Moritz, M., Kumar, A., Kim, S.E., Zhang, X., Zhu, M., Alabbad, M.H., Alhazmi, M.S., Mistry, N.P. and Kleinschmidt, K.R., 2025. Rexgroundingct: A 3d chest ct dataset for segmentation of findings from free-text reports. arXiv preprint arXiv:2507.22030.
118
119Faiyazuddin, M., Rahman, S.J.Q., Anand, G., Siddiqui, R.K., Mehta, R., Khatib, M.N., Gaidhane, S., Zahiruddin, Q.S., Hussain, A. and Sah, R. (2025),The Impact of Artificial Intelligence on Healthcare: A Comprehensive Review of Advancements in Diagnostics, Treatment, and Operational Efficiency.
120Health Science Reports, 8: e70312. https://doi.org/10.1002/hsr2.70312
121
122Suhana Bedi, Yutong Liu, Lucy Orr-Ewing, Dev Dash, Sanmi Koyejo, Alison Callahan, Jason A. Fries, Michael Wornow, Akshay Swaminathan, Lisa Soleymani Lehmann, Hyo Jung Hong, Mehr Kashyap, Akash R. Chaurasia, Nirav R. Shah, Karandeep Singh, Troy Tazbaz, Arnold Milstein, Michael A. Pfeffer, Nigam H. Shah
123Shool, S., Adimi, S., Saboori Amleshi, R. et al. A systematic review of large language model (LLM) evaluations in clinical medicine. BMC Med Inform Decis Mak 25, 117 (2025). https://doi.org/10.1186/s12911-025-02954-4
124
125Cheng, Z., Fan, R., Hao, S., Killian, T.W., Li, H., Sun, S., Ren, H., Moreno, A., Zhang, D., Zhong, T. and Xiong, Y., 2025.
126K2-think: A parameter-efficient reasoning system. arXiv preprint arXiv:2509.07604.
127
128License: Apache-2.0 for adapter weights.
129Underlying medical text sources may include portions of CC BY 4.0 datasets and synthetic expansions derived from them.
130