parser.add_argument("--max_seq_len",type=int,default=512,help="Number of words of the longest seqence.")
parser.add_argument("--use_gpu",type=ast.literal_eval,default=False,help="Whether use GPU for finetuning, input should be True or False")
parser.add_argument("--use_data_parallel",type=ast.literal_eval,default=False,help="Whether use data parallel.")
parser.add_argument("--network",type=str,default='bilstm',help="Preset network which was connected after Transformer model, such as ERNIE, BERT ,RoBERTa and ELECTRA.")
args=parser.parse_args()
# yapf: enable.
...
...
@@ -59,7 +60,7 @@ if __name__ == '__main__':
# Construct transfer learning network
# Use "pooled_output" for classification tasks on an entire sentence.
# Use "sequence_output" for token-level output.
pooled_output=outputs["pooled_output"]
pooled_output=outputs["sequence_output"]
# Setup feed list for data feeder
# Must feed all the tensor of module need
...
...
@@ -79,10 +80,15 @@ if __name__ == '__main__':
strategy=hub.AdamWeightDecayStrategy())
# Define a classfication finetune task by PaddleHub's API