Update app.py
Browse files
app.py
CHANGED
@@ -8,11 +8,11 @@ import torch
|
|
8 |
# Load PEFT adapter configuration
|
9 |
peft_config = PeftConfig.from_pretrained("unica/CLiMA")
|
10 |
|
11 |
-
# Load base model
|
12 |
base_model = AutoModelForCausalLM.from_pretrained(
|
13 |
peft_config.base_model_name_or_path,
|
14 |
torch_dtype=torch.float16,
|
15 |
-
device_map="auto"
|
|
|
16 |
)
|
17 |
|
18 |
# Load adapter weights
|
@@ -45,8 +45,8 @@ demo = gr.Interface(
|
|
45 |
title="Causal Relation Extractor with MedLlama",
|
46 |
description="Paste your clinical note or drug review, and specify two target entities. This AI agent extracts drug-condition or symptom causal relations using a fine-tuned LLM adapter model.",
|
47 |
examples=[
|
48 |
-
["
|
49 |
-
["
|
50 |
["After using Metformin, the patient experienced gastrointestinal discomfort.", "Metformin", "gastrointestinal discomfort"]
|
51 |
]
|
52 |
)
|
|
|
8 |
# Load PEFT adapter configuration
|
9 |
peft_config = PeftConfig.from_pretrained("unica/CLiMA")
|
10 |
|
|
|
11 |
base_model = AutoModelForCausalLM.from_pretrained(
|
12 |
peft_config.base_model_name_or_path,
|
13 |
torch_dtype=torch.float16,
|
14 |
+
device_map="auto",
|
15 |
+
offload_folder="./offload" # Add this line
|
16 |
)
|
17 |
|
18 |
# Load adapter weights
|
|
|
45 |
title="Causal Relation Extractor with MedLlama",
|
46 |
description="Paste your clinical note or drug review, and specify two target entities. This AI agent extracts drug-condition or symptom causal relations using a fine-tuned LLM adapter model.",
|
47 |
examples=[
|
48 |
+
["Odynophagia: Was presumed due to mucositis from recent chemotherapy.", "chemotherapy", "mucositis"],
|
49 |
+
["patient's wife noticed erythema on patient's face. On [**3-27**]the visiting nurse [**First Name (Titles) 8706**][**Last Name (Titles)11282**]of a rash on his arms as well. The patient was noted to be febrile and was admitted to the [**Company 191**] Firm. In the EW, patient's Dilantin was discontinued and he was given Tegretol instead.", "Dilantin", "erythema on patient's face"],
|
50 |
["After using Metformin, the patient experienced gastrointestinal discomfort.", "Metformin", "gastrointestinal discomfort"]
|
51 |
]
|
52 |
)
|