Downloads · 30 days
13
6% of all-time downloads
NeoAivara/Medical-Diagnosis-COT-DeepSeek
Medical-Diagnosis-COT-DeepSeek is a question answering model from NeoAivara. Use it when the input is a question plus a passage. It is set up for transformers. The card lists the license as apache-2.0.
Downloads · 30 days
13
6% of all-time downloads
All-time downloads
234
Public
Parameters
8.1B
6.3 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors6.3 GB · 100%
How the weights are stored.
U87B · 85%
From the Hugging Face model README
AI Doctor V1 is an advanced medical language model fine-tuned for clinical reasoning, diagnostic support, and treatment planning. Built on state-of-the-art transformer architecture and trained on medical reasoning datasets, this model demonstrates strong capabilities in understanding complex medical scenarios and providing structured clinical insights.
# Core libraries
!pip install unsloth # install unsloth
!pip install --force-reinstall --no-cache-dir --no-deps git+https://github.com/unslothai/unsloth.git # Also get the latest version Unsloth!
!pip install torch torchaudio transformers accelerate
!pip install trl datasets huggingface_hub wandb
# Quantization and optimization
# Install bitsandbytes
!pip install -U bitsandbytes
# Optional: For better performance
!pip install sentencepiece protobuf
from unsloth import FastLanguageModel
import torch
from trl import SFTTrainer
from unsloth import is_bfloat16_supported
from huggingface_hub import login
from transformers import TrainingArguments
from datasets import load_dataset
import wandb
from google.colab import userdata
hf_token = userdata.get('HF_TOKEN')
login(hf_token)
import torch
print("CUDA available:", torch.cuda.is_available())
print("GPU device:", torch.cuda.get_device_name(0) if torch.cuda.is_available() else "No GPU")
model_name = "NeoAivara/AI_Doctor_V1"
max_sequence_length = 2048
dtype = None
load_in_4bit = True
model, tokenizer = FastLanguageModel.from_pretrained(
model_name = model_name,
max_seq_length = max_sequence_length,
dtype = dtype,
load_in_4bit = load_in_4bit,
token = hf_token
)
prompt = f"### Question: {question}\n### Answer:"
# Define a test question
question = """What are the common symptoms of pneumonia?"""
FastLanguageModel.for_inference(model_lora)
# Tokenize the input
inputs = tokenizer([prompt_style.format(question, "")], return_tensors="pt").to("cuda")
# Generate a response
outputs = model_lora.generate (
input_ids = inputs.input_ids,
attention_mask = inputs.attention_mask,
max_new_tokens = 1200,
use_cache = True
)
# Decode the response tokens back to text
response = tokenizer.batch_decode(outputs)
answer = response.split("### Answer:")[-1].strip()
print(answer)
question = "A patient presents with fever, cough, and night sweats for 3 weeks. What should be considered?"
question = "What is the first-line treatment for uncomplicated community-acquired pneumonia in adults?"
question = "Explain the diagnostic approach for a patient with suspected acute appendicitis."
question = "Explain the pathophysiology of type 2 diabetes mellitus."
Recommended parameters for different use cases:
| Parameter | Diagnostic | Educational | Treatment Planning |
|---|---|---|---|
temperature | 0.5-0.7 | 0.7-0.8 | 0.6-0.7 |
top_p | 0.85-0.9 | 0.9-0.95 | 0.85-0.9 |
max_new_tokens | 512-768 | 768-1024 | 512-768 |
repetition_penalty | 1.1 | 1.0 | 1.1 |
🚨 CRITICAL: FOR RESEARCH AND EDUCATIONAL PURPOSES ONLY 🚨
This AI model is designed for:
This AI model is NOT intended for:
Contributions to improve the model, documentation, or use cases are welcome. Please ensure all contributions maintain the educational and research focus of this project.
This model is released under the Apache 2.0 License. See LICENSE file for details.
For questions, issues, or collaboration inquiries, please open an issue on the model repository.
Remember: AI is a tool to augment, not replace, human medical expertise.
Always prioritize patient safety and professional medical judgment.
</div>