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
File size: 774 Bytes
0c48771 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | """Small MLP used by every scorer (NER, mention pruner, relation): Linear -> ReLU -> Dropout,
one block per entry in `hidden_dims`, each block's width taken from that entry (see
configs/medbit_span_pooling/fold0.json: feedforward_params = {hidden_dims: [300, 150],
dropout: 0.4}).
"""
from typing import List
from torch import nn
class FeedForward(nn.Module):
def __init__(self, input_dim: int, hidden_dims: List[int], dropout: float):
super().__init__()
layers = []
prev = input_dim
for dim in hidden_dims:
layers += [nn.Linear(prev, dim), nn.ReLU(), nn.Dropout(dropout)]
prev = dim
self.net = nn.Sequential(*layers)
self.output_dim = prev
def forward(self, x):
return self.net(x)
|