GLiNERRelationExtraction
Relation extraction task
Default predictor
This task uses GliNERPredictor by default.
For more details, see:
GLiNERPredictorBy default, the predictor uses the knowledgator/gliner-multitask-large-v0.5 model. Learn more about the model here:
Subclass of Task.
Module: implementation.tasks
Methods and properties
Main methods and properties
__init__
Arguments:
predictor (Predictor[Any, Any], optional): Predictor that will be used in task. If equals to None, default predictor will be used. Defaults to None.
preprocess (Optional[Component], optional): Component executed before predictor.
If equals to None, default component will be used. Defaults to None. Default component: GLiNERPreprocessor | GLiNERRelationExtractionPreprocessor
postprocess (Optional[Component], optional): Component executed after predictor.
If equals to None, default component will be used. Defaults to None. Default component: GLiNERRelationExtractionPostprocessor
input_class (Type[Input], optional): Class for input validation. Defaults to RelationExtractionInput.
output_class (Type[Output], optional): Class for output validation. Defaults to RelationExtractionOutput.
name (Optional[str], optional): Name for identification. If equals to None, class name will be used. Defaults to None.
GLiNERRelationExtractionPreprocessor
Create labels for relation extraction. Subclass of Action. Type of Action[Dict[str, Any], Dict[str, Any]].
execute
Arguments:
input_data (Dict[str, Any]): Expected keys:
"relations" (List[Relation]): Relations parameters;
"entities" (List[ClassifiedEntity]): Entities to use;
Returns:
Dict[str, Any]: Expected keys:
"labels" (List[str]): Labels model inputs;
GLiNERRelationExtractionPostprocessor
Format output. Subclass of Action. Type of Action[Dict[str, Any], Dict[str, Any]].
execute
Arguments:
input_data (Dict[str, Any]): Expected keys:
"output" (List[List[Dict[str, Any]]]): Model output;
"relations" (List[Relation]): Relations parameters;
"entities" (List[ClassifiedEntity]): Entities to use;
"chunks_starts" (List[int]): Chunks starts;
Returns:
Dict[str, Any]: Expected keys:
"output" (List[Triplets]): Extracted relations;
Last updated