Imed-Ghebriout commited on
Commit
483eecb
·
verified ·
1 Parent(s): 6852aa5

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +102 -1
README.md CHANGED
@@ -12,4 +12,105 @@ tags:
12
  - medical
13
  - triage
14
  - emergency
15
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  - medical
13
  - triage
14
  - emergency
15
+ ---
16
+
17
+ # Llama-3.1-8B-Instruct-LoRA-SimSAMU
18
+
19
+ This model is a fine-tuned version of **[meta-llama/Llama-3.1-8B-Instruct](https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct)** using Low-Rank Adaptation (LoRA).
20
+
21
+ It was specifically trained on the **[medkit/simsamu](https://huggingface.co/datasets/medkit/simsamu)** dataset to perform a specialized task: generating structured, task-oriented summaries from transcripts of emergency telephone calls to the French SAMU (Service d'Aide Médicale Urgente).
22
+
23
+ The methodology and task are following the work presented in the **[QUARTZ](https://arxiv.org/abs/2509.26302)** paper.
24
+
25
+ ## Model Description
26
+
27
+ - **Base Model:** `meta-llama/Llama-3.1-8B-Instruct`
28
+ - **Dataset:** `medkit/simsamu`
29
+ - **Language:** French (`fr`)
30
+ - **Task:** The model takes a transcript of an emergency call and generates a Triage-oriented Structured Summary, extracting key information needed for medical triage and response.
31
+
32
+ ---
33
+
34
+ ## Intended Use
35
+
36
+ This model is intended for research and development purposes in the field of medical NLP. Potential applications include:
37
+ - Assisting emergency call handlers by auto-generating summaries.
38
+ - Structuring unstructured call data for analysis.
39
+ - Training and simulation for medical dispatchers.
40
+
41
+ **Note:** This model is a proof of concept and should **NOT** be used in a live clinical or emergency-response setting without extensive validation. 🚨
42
+
43
+ ---
44
+
45
+ ## How to Use
46
+
47
+ You can use this model with the `transformers` library. Make sure you are logged into your Hugging Face account and have accepted the Llama 3.1 license terms.
48
+
49
+ For more detailed examples, including the full prompts and code used, please visit the [**GitHub**](https://github.com/Mohamed-Imed-Eddine/QUARTZ) repository.
50
+
51
+ ```python
52
+ from transformers import AutoTokenizer, AutoModelForCausalLM
53
+ import torch
54
+
55
+ # Ensure you have logged in to Hugging Face CLI
56
+ # huggingface-cli login
57
+
58
+ model_id = "Imed-Ghebriout/Llama-3.1-8B-Instruct-LoRA-SimSAMU"
59
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
60
+ model = AutoModelForCausalLM.from_pretrained(
61
+ model_id,
62
+ torch_dtype=torch.bfloat16,
63
+ device_map="auto"
64
+ )
65
+
66
+ # A shortened example transcript
67
+ transcript = "medecin: bonjour docteur DETOURET au SAMU 93 vous appelez pour votre grand père c'est ça ?\npatient: oui c'est bien ça\nmedecin: d'accord vous êtes avec lui là ou pas ?\npatient: non non j'arrive là devant l'immeuble et je vois il y a de la fumée partout.\nmedecin: il y a des secours sur place monsieur ?\npatient: non non, il y a personne.\nmedecin: donc votre grand père il est à quel étage ?\npatient: il est au deuxième étage.\nmedecin: il peut se déplacer lui ou pas ?\npatient: bah je sais pas je suis pas encore rentré."
68
+
69
+ # A shortened example of the system prompt
70
+ system_prompt = """Vous êtes un médecin urgentiste. Votre tâche est de résumer le dialogue médical suivant sous la forme d’un compte rendu clinique précis et structuré.
71
+ Format du compte rapport clinique:
72
+ 1-Motif principal de l’appel:
73
+ 2-Contexte de l’appel:
74
+ 3-Contexte du patient:
75
+ 4-Traitement habituel:
76
+ 5-Antécédents médicaux:
77
+ 6-Symptômes du patient:
78
+ 7-Histoire de la maladie actuelle:
79
+ 8-Hypothèses diagnostiques:
80
+ 9-Plan de traitement:
81
+ 10-Décision d’orientation:"""
82
+
83
+ messages = [
84
+ {
85
+ "role": "system",
86
+ "content": system_prompt,
87
+ },
88
+ {
89
+ "role": "user",
90
+ "content": f"Dialogue médical:\n{transcript}\n---"
91
+ },
92
+ ]
93
+
94
+ input_ids = tokenizer.apply_chat_template(
95
+ messages,
96
+ add_generation_prompt=True,
97
+ return_tensors="pt"
98
+ ).to(model.device)
99
+
100
+ terminators = [
101
+ tokenizer.eos_token_id,
102
+ tokenizer.convert_tokens_to_ids("<|eot_id|>")
103
+ ]
104
+
105
+ outputs = model.generate(
106
+ input_ids,
107
+ max_new_tokens=512,
108
+ eos_token_id=terminators,
109
+ do_sample=True,
110
+ temperature=0.6,
111
+ top_p=0.9,
112
+ )
113
+
114
+ response = outputs[0][input_ids.shape[-1]:]
115
+ summary = tokenizer.decode(response, skip_special_tokens=True)
116
+ print(summary)