Downloads · 30 days
0
9rofe/Wernicke-AI3
Wernicke-AI3 is a machine learning model from 9rofe. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as cc-by-nc-3.0.
This model simplifies complex medical texts to a 6th-grade reading level, enhancing health literacy among patients with low health literacy.
Downloads · 30 days
0
Access
Public
Updated Jun 25, 2024
Repo size
66.9 MB
Likes
0
Public
Click a slice to open those files.
.safetensors66.9 MB · 100%
From the Hugging Face model README
This model simplifies complex medical texts to a 6th-grade reading level, enhancing health literacy among patients with low health literacy.
This model uses advanced natural language processing (NLP) algorithms to translate complex medical information into a format that is accessible to individuals with a 6th-grade reading level. The goal is to improve comprehension and health outcomes for patients with low health literacy.
The model can be used directly to simplify patient education materials to improve accessibility and comprehension.
The model can be integrated into healthcare platforms and patient portals to provide simplified information, aiding patients in understanding their medical conditions and treatment plans.
The model should not be used for generating medical advice or instructions without proper validation from healthcare professionals to avoid misinformation.
The model may not fully capture all nuances of medical information, leading to oversimplification or loss of critical details. There is also a risk of bias in the training data affecting the output.
Users should validate the simplified text with healthcare professionals to ensure accuracy and completeness of the information.
Use the code below to get started with the model.
from transformers import (
AutoConfig,
AutoModelForCausalLM,
AutoTokenizer,
BitsAndBytesConfig
)
from peft import PeftConfig
MODEL = "9rofe/Wernicke-AI3"
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_use_double_quant=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.bfloat16
)
config = PeftConfig.from_pretrained(MODEL)
model = AutoModelForCausalLM.from_pretrained(
config.base_model_name_or_path,
return_dict=True,
quantization_config=bnb_config,
device_map="auto",
trust_remote_code=True
)
tokenizer=AutoTokenizer.from_pretrained(config.base_model_name_or_path)
tokenizer.pad_token = tokenizer.eos_token
model = PeftModel.from_pretrained(model, MODEL)
generation_config = model.generation_config
generation_config.max_new_tokens = 500 # MODIFY
generation_config.temperature = 0.7
generation_config.top_p = 0.7
generation_config.num_return_sequences = 1
generation_config.pad_token_id = tokenizer.eos_token_id
generation_config.eos_token_id = tokenizer.eos_token_id
%%time
device = "cuda:0"
prompt = """
<user>: Convert this text to reading level 6: {TEXT}
<assistant>:
""".strip()
encoding = tokenizer(prompt, return_tensors="pt").to(device)
with torch.inference_mode():
outputs = model.generate(
input_ids = encoding.input_ids,
attention_mask = encoding.attention_mask,
generation_config = generation_config
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Utilize this prompt:
prompt = """
<user>: Convert this text to reading level 6: {TEXT}
<assistant>:
""".strip()
The model was trained on a comprehensive dataset of medical texts, including patient handouts and educational materials, processed to ensure readability compliance with NIH and AMA guidelines.
Medical texts were preprocessed using readability assessments such as SMOG, Flesch-Kincaid, and Gunning Fog to ensure the dataset's appropriateness for training the simplification model.
Training was conducted over 10 epochs, with checkpoints saved at regular intervals to monitor progress and performance.
The testing data comprised patient-centered materials not included in the training set, evaluated for readability and comprehension improvement.
Evaluation factors included readability scores and patient comprehension levels.
Metrics included SMOG, Flesch-Kincaid, and Gunning Fog scores, along with patient comprehension assessment through usability testing.
The model demonstrated significant improvement in readability scores and patient comprehension compared to existing AI technologies.
The AI-driven tool effectively simplified medical texts to a 6th-grade reading level, enhancing understanding and engagement among patients with low health literacy.
The model's outputs were reviewed by healthcare professionals to ensure accuracy and completeness.
Carbon emissions can be estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019).
The model is based on a sequence-to-sequence transformer architecture fine-tuned for text simplification.
Training was conducted on NVIDIA A100 GPUs.
The model was developed on Google Colab using Python and Hugging Face's Transformers library.
Health Literacy: The ability to obtain, process, and understand basic health information to make appropriate health decisions. Readability Assessments: Tools used to evaluate the reading level of a text, such as SMOG, Flesch-Kincaid, and Gunning Fog.
For further details and inquiries, please contact the model author.
Clark Parry
Visit [website] for business inquiries. Contact author for model inquiries.