StanfordAIMI / SRR-T5-Flan

huggingface.co
Total runs: 2
24-hour runs: 0
7-day runs: 0
30-day runs: -15
Model's Last Updated: June 04 2025
text-generation

Introduction of SRR-T5-Flan

Model Details of SRR-T5-Flan

Structuring Radiology Reports: Challenging LLMs with Lightweight Models

📝 Paper • 🤗 Hugging Face • 🧩 Github • 🪄 Project

import torch
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer

# step 1: Setup
model_name = "StanfordAIMI/SRR-T5-Flan"
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

# step 2: Load Processor and Model
model = AutoModelForSeq2SeqLM.from_pretrained(model_name).to(device)
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True, padding_side="right", use_fast=False)
model.eval()

# step 3: Inference (example from MIMIC-CXR dataset)
input_text = "CHEST RADIOGRAPH PERFORMED ON ___  COMPARISON: Prior exam from ___.  CLINICAL HISTORY: Weakness, assess pneumonia.  FINDINGS: Frontal and lateral views of the chest were provided. Midline sternotomy wires are again noted. The heart is poorly assessed, though remains enlarged. There are at least small bilateral pleural effusions.  There may be mild interstitial edema. No pneumothorax. Bony structures are demineralized with kyphotic angulation in the lower T-spine again noted.  IMPRESSION: Limited exam with small bilateral effusions, cardiomegaly, and possible mild interstitial edema."
inputs = tokenizer(input_text, padding="max_length", truncation=True, max_length=512, return_tensors="pt")
inputs["attention_mask"] = inputs["input_ids"].ne(tokenizer.pad_token_id)  # Add attention mask
input_ids = inputs['input_ids'].to(device)
attention_mask=inputs["attention_mask"].to(device)
generated_ids = model.generate(
    input_ids, attention_mask=attention_mask, max_new_tokens=286, min_new_tokens= 120,decoder_start_token_id=model.config.decoder_start_token_id, num_beams=5, early_stopping=True, max_length=None
    )[0]
decoded = tokenizer.decode(generated_ids, skip_special_tokens=True)

# step 4: Postprocess output
# Remove extra <pad> tokens
decoded = decoded.replace("<pad>", "").strip()

# Split into sections based on known headers or patterns
sections = ["History:", "Technique:", "Comparison:", "Findings:", "Impression:"]
organs = ['Lungs and Airways:', 'Musculoskeletal and Chest Wall:','Cardiovascular:','Tubes, Catheters, and Support Devices:','Abdominal:','Pleura:','Other:','Hila and Mediastinum:']
for section in sections:
    decoded = decoded.replace(section, f"\n{section}")
for organ in organs:
    try:
        decoded = decoded.replace(organ, f"\n{organ}")
    except:
        continue
# Ensure newlines after colons and before bullet points
decoded = decoded.replace("- ", "\n- ")
# Ensure newlines before numbers 
for i in range(1, 8):
    decoded = decoded.replace(f"{i}.", f"\n{i}.")
# Remove any leading or trailing whitespace
decoded = decoded.strip()
print(decoded)
✏️ Citation
@article{structuring-2025,
  title={Structuring Radiology Reports: Challenging LLMs with Lightweight Models},
  author={Moll, Johannes and Fay, Louisa and Azhar, Asfandyar and Ostmeier, Sophie and Lueth, Tim and Gatidis, Sergios and Langlotz, Curtis and Delbrouck, Jean-Benoit},
  journal={arXiv preprint arXiv:2506.00200},
  url={https://arxiv.org/abs/2506.00200},
  year={2025}
}

Runs of StanfordAIMI SRR-T5-Flan on huggingface.co

2
Total runs
0
24-hour runs
0
3-day runs
0
7-day runs
-15
30-day runs

More Information About SRR-T5-Flan huggingface.co Model

SRR-T5-Flan huggingface.co

SRR-T5-Flan huggingface.co is an AI model on huggingface.co that provides SRR-T5-Flan's model effect (), which can be used instantly with this StanfordAIMI SRR-T5-Flan model. huggingface.co supports a free trial of the SRR-T5-Flan model, and also provides paid use of the SRR-T5-Flan. Support call SRR-T5-Flan model through api, including Node.js, Python, http.

StanfordAIMI SRR-T5-Flan online free

SRR-T5-Flan huggingface.co is an online trial and call api platform, which integrates SRR-T5-Flan's modeling effects, including api services, and provides a free online trial of SRR-T5-Flan, you can try SRR-T5-Flan online for free by clicking the link below.

StanfordAIMI SRR-T5-Flan online free url in huggingface.co:

https://huggingface.co/StanfordAIMI/SRR-T5-Flan

SRR-T5-Flan install

SRR-T5-Flan is an open source model from GitHub that offers a free installation service, and any user can find SRR-T5-Flan on GitHub to install. At the same time, huggingface.co provides the effect of SRR-T5-Flan install, users can directly use SRR-T5-Flan installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

SRR-T5-Flan install url in huggingface.co:

https://huggingface.co/StanfordAIMI/SRR-T5-Flan

Url of SRR-T5-Flan

Provider of SRR-T5-Flan huggingface.co

StanfordAIMI
ORGANIZATIONS

Other API from StanfordAIMI

huggingface.co

Total runs: 4.2K
Run Growth: 2.2K
Growth Rate: 51.81%
Updated:April 02 2026
huggingface.co

Total runs: 1.6K
Run Growth: 345
Growth Rate: 20.92%
Updated:November 19 2022