Feature Extraction
Transformers
Safetensors
Italian
radgraph_it
radiology
information-extraction
named-entity-recognition
relation-extraction
medical
radgraph
custom_code
Instructions to use radgraphIT/Radgraph-IT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use radgraphIT/Radgraph-IT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="radgraphIT/Radgraph-IT", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("radgraphIT/Radgraph-IT", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Add transformers-compatible wrapper (AutoModel/AutoTokenizer via trust_remote_code)
0c48771 verified | """Run a trained model on a document and get back decoded predictions. | |
| Port of the one thing `radgraph.dygie.predictors.dygie.DyGIEPredictor` did that this project | |
| actually used: forward pass -> `PredictedNER` / `PredictedRelation` objects, in document | |
| (here: sentence, since there's always exactly one) coordinates. | |
| """ | |
| import torch | |
| from .dataset import Example, build_example | |
| from .document import Document | |
| from .model import DyGIEModel | |
| from .vocab import Vocabulary | |
| def predict_document(model: DyGIEModel, vocab: Vocabulary, doc: Document, max_span_width: int) -> dict: | |
| model.eval() | |
| example: Example = build_example(doc, vocab, max_span_width) | |
| output = model(example) | |
| return { | |
| "doc_key": doc.doc_key, | |
| "example": example, | |
| "predicted_ner": output["ner"].get("predictions", []), | |
| "predicted_relations": output["relation"].get("predictions", []), | |
| } | |