Commit
·
9b14a58
1
Parent(s):
e7e3b45
Update app.py
Browse files
app.py
CHANGED
@@ -13,25 +13,12 @@ st.markdown("<h1 style='text-align: center; color: #489DDB;'>GPT Clinical Notes
|
|
13 |
st.markdown("<h6 style='text-align: center; color: #489DDB;'>by Bryan Mildort</h1>", unsafe_allow_html=True)
|
14 |
|
15 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
16 |
-
|
17 |
tokenizer = AutoTokenizer.from_pretrained("bryanmildort/gpt-clinical-notes-summarizer")
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
checkpoint = "bryanmildort/gpt-clinical-notes-summarizer"
|
22 |
-
config = AutoConfig.from_pretrained(checkpoint)
|
23 |
-
|
24 |
-
with init_empty_weights():
|
25 |
-
model = AutoModelForCausalLM.from_config(config)
|
26 |
-
|
27 |
-
from accelerate import load_checkpoint_and_dispatch
|
28 |
-
|
29 |
-
model = load_checkpoint_and_dispatch(
|
30 |
-
model, './', device_map="auto", no_split_module_classes=["GPTJBlock"]
|
31 |
)
|
32 |
|
33 |
-
# model = AutoModelForCausalLM.from_pretrained("bryanmildort/gpt-clinical-notes-summarizer", low_cpu_mem_usage=True, load_in_8bit=True, device_map="auto")
|
34 |
-
|
35 |
prompt = """Edie Whelan is a 26 yo female who is here for follow-up following an ED visit for palpitations 2 weeks ago. She had a normal workup in the ED consisting of CBC, metabolic panel, cardiac enzymes and and ECG. She states that she has a 5 yr hx of palpitations with SOB, throat tightening, nause and clamminess. these have been increasing in frequency in the past few weeks to 1-2x a day until 2 weeks ago when she had associated numbness in her fingers. She states that there are no precipitating events and these stop on their own. She endorses recent life stressors having bought a condo 3 months ago and lost her job 2 months ago. She denies fevers, chills, changes in skin/hair/nails or chest pain/tightness. She denies vision or hearing changes.
|
36 |
PMH: none, Meds: none, Allergies: none, Surgeries: None, Family hx: none
|
37 |
Social: denies caffeine, tobacco, alcohol, and drug use. Is in a monogomous relationship and has sex with condoms"""
|
|
|
13 |
st.markdown("<h6 style='text-align: center; color: #489DDB;'>by Bryan Mildort</h1>", unsafe_allow_html=True)
|
14 |
|
15 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
16 |
+
import torch
|
17 |
tokenizer = AutoTokenizer.from_pretrained("bryanmildort/gpt-clinical-notes-summarizer")
|
18 |
+
model = AutoModelForCausalLM.from_pretrained(
|
19 |
+
"bryanmildort/gpt-clinical-notes-summarizer", torch_dtype=torch.float16, low_cpu_mem_usage=True,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
)
|
21 |
|
|
|
|
|
22 |
prompt = """Edie Whelan is a 26 yo female who is here for follow-up following an ED visit for palpitations 2 weeks ago. She had a normal workup in the ED consisting of CBC, metabolic panel, cardiac enzymes and and ECG. She states that she has a 5 yr hx of palpitations with SOB, throat tightening, nause and clamminess. these have been increasing in frequency in the past few weeks to 1-2x a day until 2 weeks ago when she had associated numbness in her fingers. She states that there are no precipitating events and these stop on their own. She endorses recent life stressors having bought a condo 3 months ago and lost her job 2 months ago. She denies fevers, chills, changes in skin/hair/nails or chest pain/tightness. She denies vision or hearing changes.
|
23 |
PMH: none, Meds: none, Allergies: none, Surgeries: None, Family hx: none
|
24 |
Social: denies caffeine, tobacco, alcohol, and drug use. Is in a monogomous relationship and has sex with condoms"""
|