Views
No views yet
pip install transformers peft torch1from transformers import AutoModelForCausalLM, AutoTokenizer
2from peft import PeftModel
3import torch
4
5# Load base model and tokenizer
6base_model = AutoModelForCausalLM.from_pretrained(
7 "meta-llama/Llama-3.1-8B",
8 torch_dtype=torch.bfloat16,
9 device_map="auto"
10)
11tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-3.1-8B")
12
13# Load LoRA adapter
14model = PeftModel.from_pretrained(base_model, "BryanTegomoh/EpiBrief-MMWR-LM")
15
16# Generate
17prompt = """Based on this MMWR article excerpt, generate an executive summary following CDC format with 'What is already known about this topic?', 'What is added by this report?', and 'What are the implications for public health practice?' sections.
18
19Measles cases have increased 300% in the United States during 2024, with 97% occurring among unvaccinated individuals. The outbreak was concentrated in communities with vaccination rates below 85%.
20
21Generate the CDC-style executive summary:"""
22
23inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
24outputs = model.generate(**inputs, max_new_tokens=400, temperature=0.7)
25print(tokenizer.decode(outputs[0], skip_special_tokens=True))Measles is a highly contagious vaccine-preventable viral disease. Increasing U.S. measles cases have been driven by unvaccinated persons who are exposed while traveling internationally. U.S. health officials should coordinate response activities to prevent and limit the spread, assess and improve vaccination coverage, and ensure MMR vaccination for all eligible children and adults.
1@model{tegomoh2025epibrief,
2 author = {Bryan Tegomoh},
3 title = {EpiBrief-MMWR-LM: A Specialized Language Model for CDC-Style Epidemiological Reasoning},
4 year = {2025},
5 publisher = {HuggingFace},
6 url = {https://huggingface.co/BryanTegomoh/EpiBrief-MMWR-LM}
7}