code: def test_run(self):
      #  检测是否能够使用SequenceGeneratorModel训练, 透传预测
      embed, dl = prepare_env()
      model1 = TransformerSeq2SeqModel.build_model(
          src_embed=embed,
          tgt_embed=None,
          pos_embed="sin",
          max_position=20,
          num_layers=2,
          d_model=30,
          n_head=6,
          dim_ff=20,
          dropout=0.1,
          bind_encoder_decoder_embed=True,
          bind_decoder_input_output_embed=True,
      )
      optimizer = torch.optim.Adam(model1.parameters(), lr=1e-3)
      trainer = Trainer(
          model1,
          driver="torch",
          optimizers=optimizer,
          train_dataloader=dl,
          n_epochs=100,
          evaluate_dataloaders=dl,
          metrics={"acc": Accuracy()},
          evaluate_input_mapping=lambda x: {
              "target": x["tgt_tokens"],
              "seq_len": x["tgt_seq_len"],
              **x,
          },
          callbacks=ExitCallback(),
      )
  
      trainer.run()
  
      embed, dl = prepare_env()
      model2 = LSTMSeq2SeqModel.build_model(
          src_embed=embed,
          tgt_embed=None,
          num_layers=1,
          hidden_size=20,
          dropout=0.1,
          bind_encoder_decoder_embed=True,
          bind_decoder_input_output_embed=True,
          attention=True,
      )
      optimizer = torch.optim.Adam(model2.parameters(), lr=0.01)
      trainer = Trainer(
          model2,
          driver="torch",
          optimizers=optimizer,
          train_dataloader=dl,
          n_epochs=100,
          evaluate_dataloaders=dl,
          metrics={"acc": Accuracy()},
          evaluate_input_mapping=lambda x: {
              "target": x["tgt_tokens"],
              "seq_len": x["tgt_seq_len"],
              **x,
          },
          callbacks=ExitCallback(),
      )
      trainer.run()
  
file_path: fastNLP/tests/models/torch/test_seq2seq_generator.py
imports: import pytest
  from fastNLP.envs.imports import _NEED_IMPORT_TORCH
  from fastNLP import Vocabulary, DataSet
  from fastNLP import Trainer, Accuracy
  from fastNLP import Callback, TorchDataLoader
label_desc: Use image node_id 1 for calling the TestSeq2SeqGeneratorModel obj's underlying member method code with example usage: obj.test_run() without return types