Downloads · 30 days
0
0% of all-time downloads
alibidaran/Gemma2_Virtual_doctor
Gemma2_Virtual_doctor is a text generation model from alibidaran. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
This model is fined tune based on Google's Gemma model for creating virtual doctor or medical Asistant. It can be used in medical and healthcare AI assitant apps and chatbots.
Downloads · 30 days
0
0% of all-time downloads
All-time downloads
7
Public
Parameters
2.5B
10.4 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors5.3 GB · 99%
From the Hugging Face model README
This model is fined tune based on Google's Gemma model for creating virtual doctor or medical Asistant. It can be used in medical and healthcare AI assitant apps and chatbots.
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig, GemmaTokenizer
model_id = "alibidaran/Gemma2_Virtual_doctor"
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.bfloat16
)
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, quantization_config=bnb_config, device_map={"":0})
prompt = " Hi doctor, I feel a pain on my ankle, I walk hardly and with pain what do you recommend me?"
text=f"<s> ###Human: {prompt} ###Asistant: "
inputs=tokenizer(text,return_tensors='pt').to('cuda')
with torch.no_grad():
outputs=model.generate(**inputs,max_new_tokens=200,do_sample=True,top_p=0.92,top_k=10,temperature=0.7)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
per_device_train_batch_size=1,
gradient_accumulation_steps=8,
warmup_steps=2,
#max_steps=200,
num_train_epochs=1,
learning_rate=2e-4,
fp16=True,
logging_steps=100,
output_dir="outputs",
optim="paged_adamw_8bit",
save_steps=500,
ddp_find_unused_parameters=False // for training on multiple GPU