odin-deus/odin-llama3.1-medical-ner-v14
012
odin-llama3.1-medical-ner-v14
A LoRA adapter fine-tuned for medical Named Entity Recognition (NER) and Relation Extraction (RE).
Task
Extracts medical entities and their relationships from clinical text.
- Entity types: Disease, Drug, Symptom
- Relation types: associatedwith, causes, interactswith, treats
Model Details
- Base model: unsloth/meta-llama-3.1-8b-bnb-4bit
- LoRA rank (r): 32
- LoRA alpha: 32
- Target modules: qproj, gateproj, vproj, upproj, downproj, oproj, k_proj
- PEFT type: LORA
Evaluation Results
Usage
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base_model = "unsloth/meta-llama-3.1-8b-bnb-4bit"
adapter_id = "pabloformoso/odin-llama3.1-medical-ner-v14"
tokenizer = AutoTokenizer.from_pretrained(adapter_id)
model = AutoModelForCausalLM.from_pretrained(base_model, device_map="auto")
model = PeftModel.from_pretrained(model, adapter_id)
prompt = """### Instruction:
Extract all medical entities and their relations from the following clinical text.
### Input:
The patient developed acute renal failure after treatment with enalapril.
### Output:"""
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))Training Data
Combined dataset from:
- ADE Corpus V2: Drug–adverse effect relations
- BC5CDR: Chemical–disease relations
- BioRED: Biomedical relation extraction
