span_marker.pipeline_component moduleΒΆ
- class span_marker.pipeline_component.SpanMarkerPipeline(model, tokenizer=None, feature_extractor=None, image_processor=None, processor=None, modelcard=None, framework=None, task='', args_parser=None, device=None, torch_dtype=None, binary_output=False, **kwargs)[source]ΒΆ
Bases:
Pipeline
A Pipeline component for SpanMarker.
The pipeline function is
pipeline()
, which you can also import withfrom transformers import pipeline
, but you must also importspan_marker
to register the"span-marker"
pipeline task.Example:
>>> from span_marker import pipeline >>> pipe = pipeline(task="span-marker", model="tomaarsen/span-marker-mbert-base-multinerd", device_map="auto") >>> pipe("Amelia Earhart flew her single engine Lockheed Vega 5B across the Atlantic to Paris.") [{'span': 'Amelia Earhart', 'label': 'PER', 'score': 0.9999709129333496, 'char_start_index': 0, 'char_end_index': 14}, {'span': 'Lockheed Vega 5B', 'label': 'VEHI', 'score': 0.9050095677375793, 'char_start_index': 38, 'char_end_index': 54}, {'span': 'Atlantic', 'label': 'LOC', 'score': 0.9991973042488098, 'char_start_index': 66, 'char_end_index': 74}, {'span': 'Paris', 'label': 'LOC', 'score': 0.9999232292175293, 'char_start_index': 78, 'char_end_index': 83}]
- Parameters:
model (PreTrainedModel | TFPreTrainedModel) β
tokenizer (PreTrainedTokenizer | None) β
feature_extractor (SequenceFeatureExtractor | None) β
image_processor (BaseImageProcessor | None) β
processor (ProcessorMixin | None) β
modelcard (ModelCard | None) β
framework (str | None) β
task (str) β
args_parser (ArgumentHandler) β
device (int | torch.device) β
torch_dtype (str | torch.dtype | None) β
binary_output (bool) β