Text summarization training

更新时间:
复制 MD 格式

Train Transformer models to generate summaries and headlines from source documents.

Limitations

Runs only on DLC compute resources.

How it works

The component uses a standard Transformer encoder-decoder architecture. During training, the encoder reads the source text and the decoder generates the output summary.

Prerequisites

Before you begin, make sure you have:

  • Connected a Sentence Split component upstream to split source text into one sentence per line

  • Uploaded training and validation datasets to OSS

Parameters

Configure parameters in Designer after adding the component to your workflow.

Input ports

Port (left to right)Data typeUpstream componentRequired
Training dataOSSRead OSS DataYes
Validation dataOSSRead OSS DataYes

Field Settings tab

ParameterDefaultDescription
Input data formattarget:str:1,source:str:1Column definitions in the input file. Each field is name:type:count. The default defines two columns: source (source text) and target (summary text).
Source columnsourceColumn name containing source text.
Summary Column SelectiontargetColumn name containing summary text.
Model save pathOSS directory where the trained model is saved.

Data format details

The input file uses tab-separated columns by default. Each row is one training example:

ColumnContentExample
sourceSource document textScientists discover new exoplanet...
targetExpected summary or headlineNew exoplanet found

CSV format is also supported.

Parameter Settings tab

ParameterTypeRangeDefaultDescription
Pre-trained modelalibaba-pai/mt5-title-generation-zhPre-trained model to fine-tune.
Batch sizeINT>016Samples processed per training step. For multi-GPU instances, this is the per-GPU batch size.
Maximum text lengthINT1–512512Maximum input sequence length in tokens.
Number of epochsINT>03Number of full passes through the training dataset.
Learning rateFLOAT>03e-5Learning rate for model weight updates.
Steps to Save a Model File>0150Number of training steps between model evaluations and checkpoint saves.
Languagezh, enLanguage of the training data. Use zh for Chinese, en for English.
Copy text from sourcetrue, falsefalseWhether to copy source text to the output. Set to true if your downstream pipeline needs both source and generated summary.
Minimum decoder lengthINT>=012Minimum output length in tokens.
Maximum decoder lengthINT>032Maximum output length in tokens.
Minimum non-repeated n-gramINT>=12Minimum n-gram length that cannot repeat in the output. Set to 1 to prevent repeated words (e.g., "day"). Higher values reduce repetition of longer phrases.
Beam search sizeINT>=15Search space size for candidate outputs. Larger values reduce prediction speed.
Number of returned candidatesINT>=15Number of top-scoring candidates to return from beam search.

Execution Tuning tab

ParameterDefaultDescription
GPU machine typegn5-c8g1.2xlargeGPU instance type for training.

Output port

Output portData typeDownstream componentRequired
Output modelOSS path (SavedModel format)Text Summarization PredictNo

The model is saved to the OSS directory specified in Model save path on the Field Settings tab.

Run a text summarization training workflow

This example trains a Chinese summarization model using sample datasets.

Workflow
  1. Download the training dataset (cn_train.txt) and validation dataset (cn_dev.txt), then upload both files to OSS. Both files use TXT format with tab-separated fields.

    CSV format is also supported. To upload datasets using MaxCompute, use Tunnel commands in the MaxCompute client. For details, see Connect using the client (odpscmd) and Tunnel commands.
  2. Add Read OSS Data-1 and Read OSS Data-2 components to the workflow. Set OSS Data Path on each component to the location of the training and validation datasets respectively.

  3. Connect Read OSS Data-1 (training data) and Read OSS Data-2 (validation data) to the Text Summarization Training-1 component. Configure parameters as described in Parameters.

  4. Click image.png to run the workflow. After the workflow completes, the trained model is saved to the OSS path specified in Model save path.

What's next