Edit model card

You need to agree to share your contact information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.

Model Card for Model ID

Model Details

Model Description

Uses

Below we share some code snippets on how to get quickly started with running the model. First, install the Transformers library with:

pip install -U transformers
pip install -U torch

Then, copy the snippet from the section that is relevant for your usecase.

Direct Use

Running the model on Single/Multi GPU

# pip install accelerate
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

tokenizer = AutoTokenizer.from_pretrained("Ellio98/doctor-gemma-2-2b-it")
model = AutoModelForCausalLM.from_pretrained(
    "Ellio98/doctor-gemma-2-2b-it",
    device_map="auto",
    torch_dtype=torch.bfloat16,
)

query = "I have a high fever and coughing since morning. What should I do ?"

prompt = [{"role": "user", "content": query}]

model_input = tokenizer(tokenizer.apply_chat_template(prompt, tokenize=False), return_tensors="pt")

outputs = model.generate(
                          input_ids=model_input["input_ids"].to("cuda"),
                          attention_mask=model_input["attention_mask"].to("cuda"),
                          max_new_tokens=32
)

print(tokenizer.decode(outputs[0], skip_special_tokens=True))
# user
# I have a high fever and coughing since morning. What should I do ?
# model
# Hi,From history it seems that you might be having viral infection giving this problem of fever with cough.
# Take paracetamol or ibuprofen for pain due to fever. Take plenty of water.
# If require take one antispasmodic medicine like Meftal spas as needed.
# Ok and take care.

Bias, Risks, and Limitations

The model might not be good at generating the desired output and might suggest some weird medical practices that does not make sense. It is highly recommended to use this model just for research purpose and not as a commercial use. Also, as no data anonymization was performed, the model will be generating random names, addresses or terms that are not intended.

Future Works

Need to perform data anonymization to refine the model output to be generic.

Training Details

Training Data

For fine-tuning the model, 5000 samples were indiced from the sid6i7/patient-doctor dataset, out of which 4500 were used for training, 250 were used for validation and testing.

Training Hyperparameters

  • Training regime: [More Information Needed]
  • precision: bfloat16
  • alpha: 32
  • rank: 16
  • lora dropout: 0.05
  • target modules: 'o_proj', 'v_proj', 'up_proj', 'q_proj', 'down_proj', 'gate_proj', and 'k_proj'
  • optimizer: paged_adamw_32bit
  • learning rate: 2e-4

Results

The loss progression during fine-tuning of gemma-2-2b on the dataset is as follows:

image/png

Hardware

The model was trained on 2 x T4 GPU. The total training time taken was 6 hours.

Downloads last month
16
Safetensors
Model size
1.63B params
Tensor type
F32
·
FP16
·
U8
·
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Model tree for Ellio98/doctor-gemma-2-2b-it

Base model

google/gemma-2-2b
Quantized
(110)
this model

Dataset used to train Ellio98/doctor-gemma-2-2b-it