abhishek-ch commited on
Commit
a8d9eb7
1 Parent(s): aa3749b

update transformer

Browse files
Files changed (1) hide show
  1. README.md +27 -4
README.md CHANGED
@@ -36,7 +36,8 @@ Refer to the [original model card](https://huggingface.co/BioMistral/BioMistral-
36
  pip install mlx-lm
37
  ```
38
 
39
- The model was fine-tuned on [health_facts](https://huggingface.co/datasets/health_fact) and Synthetic EHR dataset inspired by MIMIC-IV, for 1000 steps using mlx
 
40
 
41
  ```python
42
  def format_prompt(prompt:str, question: str) -> str:
@@ -51,8 +52,8 @@ def format_prompt(prompt:str, question: str) -> str:
51
 
52
  Example For EHR Diagnosis
53
  ```
54
- Prompt = """You are an expert in provide diagnosis summary based on clinical notes.
55
- Objective: Your task is to generate concise summaries of the diagnosis, focusing on critical information"""
56
  ```
57
 
58
  Example for Healthfacts Check
@@ -60,7 +61,7 @@ Example for Healthfacts Check
60
  Prompt: You are a Public Health AI Assistant. You can do the fact-checking of public health claims. \nEach answer labelled with true, false, unproven or mixture. \nPlease provide the reason behind the answer
61
  ```
62
 
63
- ## Model Loading Using mlx
64
 
65
  ```python
66
  from mlx_lm import generate, load
@@ -75,3 +76,25 @@ response = generate(
75
  )
76
  ```
77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  pip install mlx-lm
37
  ```
38
 
39
+ The model was LoRA fine-tuned on [health_facts](https://huggingface.co/datasets/health_fact) and
40
+ Synthetic EHR dataset inspired by MIMIC-IV using the format below, for 1000 steps (~1M tokens) using mlx.
41
 
42
  ```python
43
  def format_prompt(prompt:str, question: str) -> str:
 
52
 
53
  Example For EHR Diagnosis
54
  ```
55
+ Prompt = """You are an expert in provide diagnosis summary based on clinical notes inspired by MIMIC-IV-Note dataset.
56
+ These notes encompass Chief Complaint along with Patient Summary & medical admission details."""
57
  ```
58
 
59
  Example for Healthfacts Check
 
61
  Prompt: You are a Public Health AI Assistant. You can do the fact-checking of public health claims. \nEach answer labelled with true, false, unproven or mixture. \nPlease provide the reason behind the answer
62
  ```
63
 
64
+ ## Loading the model using `mlx`
65
 
66
  ```python
67
  from mlx_lm import generate, load
 
76
  )
77
  ```
78
 
79
+ ## Loading the model using `transformers`
80
+
81
+ ```python
82
+ from transformers import AutoModelForCausalLM, AutoTokenizer
83
+
84
+ repo_id = "abhishek-ch/biomistral-7b-synthetic-ehr"
85
+
86
+ tokenizer = AutoTokenizer.from_pretrained(repo_id)
87
+ model = AutoModelForCausalLM.from_pretrained(repo_id)
88
+ model.to("mps")
89
+
90
+ input_text = format_prompt(system_prompt, question)
91
+ input_ids = tokenizer(input_text, return_tensors="pt").to("mps")
92
+
93
+ outputs = model.generate(
94
+ **input_ids,
95
+ max_new_tokens=512,
96
+ )
97
+ print(tokenizer.decode(outputs[0]))
98
+
99
+ ```
100
+