# TransformersTextSummarization

Subclass of [**Task**](https://utca.knowledgator.com/tasks/task)**.**&#x20;

## Module: [implementation](https://utca.knowledgator.com/framework-structure#implementation).tasks

## Default predictor

This task uses [**TransformersModel**](https://utca.knowledgator.com/predictors/transformers-predictors#transformersmodel) by default with this configuration:

{% code overflow="wrap" fullWidth="false" %}

```python
TransformersPipeline(
    TransformersPipelineConfig(
        task="summarization", 
        model="facebook/bart-large-cnn",
    ),
    input_class=SummarizationInput,
    output_class=TransformersBasicOutput
)
```

{% endcode %}

#### **See:**

* [**TransformersPipeline**](https://utca.knowledgator.com/predictors/transformers-predictors#transformerspipeline)&#x20;
* [**TransformersPipelineConfig**](https://utca.knowledgator.com/predictors/transformers-predictors#transformerspipelineconfig)
* [**SummarizationInput**](#summarizationinput)
* [**TransformersBasicOutput**](https://utca.knowledgator.com/predictors/transformers-schemas#transformersbasicoutput)

## Methods and properties

Main methods and properties

***

### <mark style="color:blue;">\_\_init\_\_</mark>

#### Arguments:

* <mark style="color:orange;">**predictor**</mark>**&#x20;(**[**Predictor**](https://utca.knowledgator.com/predictors/predictor)**\[Any, Any], optional):** Predictor that will be used in task. If equals to None, [**default predictor**](#default-predictor) will be used. Defaults to None.
* <mark style="color:orange;">**preprocess**</mark>**&#x20;(Optional\[**[**Component**](https://utca.knowledgator.com/core/component)**], optional):** Component executed before predictor. Defaults to None.
* <mark style="color:orange;">**postprocess**</mark>**&#x20;(Optional\[**[**Component**](https://utca.knowledgator.com/core/component)**], optional):** Component executed after predictor. If equals to None, default component will be used. Defaults to None.\
  \
  Default component: \
  [**SummarizationPostprocess**](#summarizationpostprocess)
* <mark style="color:orange;">**input\_class**</mark>**&#x20;(Type\[**[**Input**](https://utca.knowledgator.com/core/schemas#input)**], optional):** Class for input validation. Defaults to [**SummarizationInput**](#summarizationinput)**.**
* <mark style="color:orange;">**output\_class**</mark>**&#x20;(Type\[**[**Output**](https://utca.knowledgator.com/core/schemas#output)**], optional):** Class for output validation. Defaults to [**SummarizationOutput**](#summarizationoutput)**.**
* <mark style="color:orange;">**name**</mark>**&#x20;(Optional\[str], optional):** Name for identification. If equals to None, class name will be used. Defaults to None.

***

***

***

## <mark style="color:green;">SummarizationInput</mark>

Subclass of [**IOModel**](https://utca.knowledgator.com/core/schemas#iomodel)**.**

***

### <mark style="color:blue;">\_\_init\_\_</mark>

#### Args:

* <mark style="color:orange;">**inputs**</mark>**&#x20;(str)**
* <mark style="color:orange;">**max\_length**</mark>**&#x20;(int)**
* <mark style="color:orange;">**min\_length**</mark>**&#x20;(int)**

***

***

***

## <mark style="color:green;">SummarizationOutput</mark>

Subclass of [**IOModel**](https://utca.knowledgator.com/core/schemas#iomodel)**.**

***

### <mark style="color:blue;">\_\_init\_\_</mark>

#### Args:

* <mark style="color:orange;">**summary\_text**</mark>**&#x20;(str)**

***

***

***

## <mark style="color:green;">SummarizationPostprocess</mark>

Format model output. Subclass of [**Action**](https://utca.knowledgator.com/core/action). Type of [**Action**](https://utca.knowledgator.com/core/action)**\[Dict\[str, Any], Dict\[str, Any]].**

***

### <mark style="color:blue;">execute</mark>

#### Arguments:

* <mark style="color:orange;">**input\_data**</mark>**&#x20;(Dict\[str, Any]):** \
  Expected keys:
  * <mark style="color:red;">**"output"**</mark>**&#x20;(Any):** Model output;

#### Returns:

* **Dict\[str, Any]:** \
  Expected keys:
  * <mark style="color:red;">**"summary\_text"**</mark>**&#x20;(str);**

***

***
