Model Card for Model ID

Model Details

Model Description

  • Developed by: [More Information Needed]
  • Funded by [optional]: [More Information Needed]
  • Shared by [optional]: [More Information Needed]
  • Model type: [More Information Needed]
  • Language(s) (NLP): [More Information Needed]
  • License: [More Information Needed]
  • Finetuned from model [optional]: [More Information Needed]

Model Sources [optional]

  • Repository: [More Information Needed]
  • Paper [optional]: [More Information Needed]
  • Demo [optional]: [More Information Needed]

Uses

Direct Use

[More Information Needed]

Downstream Use [optional]

[More Information Needed]

Out-of-Scope Use

[More Information Needed]

Bias, Risks, and Limitations

[More Information Needed]

Recommendations

Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.

How to Get Started with the Model

Use the code below to get started with the model.

[More Information Needed]

Training Details

Training Data

[More Information Needed]

Training Procedure

Preprocessing [optional]

[More Information Needed]

Training Hyperparameters

  • Training regime: [More Information Needed]

Speeds, Sizes, Times [optional]

[More Information Needed]

Evaluation

Testing Data, Factors & Metrics

Testing Data

[More Information Needed]

Factors

[More Information Needed]

Metrics

[More Information Needed]

Results

[More Information Needed]

Summary

Model Examination [optional]

[More Information Needed]

Environmental Impact

Carbon emissions can be estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019).

  • Hardware Type: [More Information Needed]
  • Hours used: [More Information Needed]
  • Cloud Provider: [More Information Needed]
  • Compute Region: [More Information Needed]
  • Carbon Emitted: [More Information Needed]

Technical Specifications [optional]

Model Architecture and Objective

[More Information Needed]

Compute Infrastructure

[More Information Needed]

Hardware

[More Information Needed]

Software

[More Information Needed]

Citation [optional]

BibTeX:

[More Information Needed]

APA:

[More Information Needed]

Glossary [optional]

[More Information Needed]

More Information [optional]

[More Information Needed]

Model Card Authors [optional]

[More Information Needed]

Model Card Contact

[More Information Needed]

Framework versions

  • PEFT 0.15.2

Utilisation avec LoRA

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
from peft import PeftModel

# Configuration
base_model_id = "google/medgemma-4b-it"
model_id = "Sadou/medgemma-4b-it-medical-report-simplifier"
device = "cuda" if torch.cuda.is_available() else "cpu"

# Chargement du modèle de base
base_model = AutoModelForCausalLM.from_pretrained(
    base_model_id,
    quantization_config=BitsAndBytesConfig(load_in_4bit=True),
    device_map="auto",
    torch_dtype=torch.bfloat16,
)

# Chargement des adaptateurs LoRA fine-tunés
model = PeftModel.from_pretrained(base_model, model_id)

# Chargement du tokenizer
tokenizer = AutoTokenizer.from_pretrained(base_model_id)

def simplify_medical_report(medical_text, max_length=300, temperature=0.3):
    """
    Simplifie un rapport médical pour un patient
    
    Args:
        medical_text (str): Texte médical à simplifier
        max_length (int): Longueur maximale de la réponse
        temperature (float): Créativité (0.1 = conservateur, 0.7 = créatif)
    
    Returns:
        str: Explication simplifiée et rassurante
    """
    
    prompt = f"""<start_of_turn>user
{medical_text}<end_of_turn>
<start_of_turn>model
"""
    
    inputs = tokenizer(prompt, return_tensors="pt").to(device)
    
    with torch.inference_mode():
        outputs = model.generate(
            **inputs,
            max_new_tokens=max_length,
            do_sample=True,
            temperature=temperature,
            pad_token_id=tokenizer.eos_token_id,

        )
    
    response = tokenizer.decode(outputs[0][inputs.input_ids.shape[-1]:], skip_special_tokens=True)
    return response.strip()

# Exemple d'utilisation
medical_text = "Bilan thyroïdien : 'TSH : 8.5 mUI/L (N: 0.4-4.0), T4 libre : 10 pmol/L (N: 10-25). Hypothyroïdie fruste.'"
simplified = simplify_medical_report(medical_text)
print(f"📋 Rapport médical:\n{medical_text}\n")
print(f"💬 Explication patient:\n{simplified}\n")
Downloads last month
4
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Sadou/medgemma-4b-it-medical-report-simplifier

Adapter
(14)
this model