code: def test_force_predictions_on_eval(self):
      tensorizers = get_tensorizers()
  
      model = Seq2SeqModel.from_config(
          Seq2SeqModel.Config(
              source_embedding=WordEmbedding.Config(embed_dim=512),
              target_embedding=WordEmbedding.Config(embed_dim=512),
          ),
          tensorizers,
      )
  
      # Get sample inputs using a data source.
      schema = {
          "source_sequence": str,
          "dict_feat": Gazetteer,
          "target_sequence": str,
      }
      data = Data.from_config(
          Data.Config(
              source=TSVDataSource.Config(
                  train_filename=TEST_FILE_NAME,
                  field_names=[
                      "source_sequence",
                      "dict_feat",
                      "target_sequence",
                  ],
              )
          ),
          schema,
          tensorizers,
      )
      data.batcher = Batcher(1, 1, 1)
      raw_batch, batch = next(
          iter(data.batches(Stage.TRAIN, load_early=True))
      )
      inputs = model.arrange_model_inputs(batch)
  
      # Verify that model does not run sequence generation on prediction.
      outputs = model(*inputs)
      pred = model.get_pred(outputs, {"stage": Stage.EVAL})
      self.assertEqual(pred, (None, None))
  
      # Verify that attempting to set force_eval_predictions is correctly
      # accounted for.
      model.force_eval_predictions = True
      with self.assertRaises(AssertionError):
          _ = model.get_pred(outputs, {"stage": Stage.EVAL})
  
imports: import unittest
  import torch
  from pytext.common.constants import Stage
  from pytext.data import Batcher
  from pytext.data.data import Data
  from pytext.data.sources.data_source import Gazetteer
  from pytext.data.sources.tsv import TSVDataSource
  from pytext.data.tensorizers import ByteTokenTensorizer, GazetteerTensorizer, initialize_tensorizers, TokenTensorizer
  from pytext.models.embeddings import ContextualTokenEmbedding, DictEmbedding, WordEmbedding
  from pytext.models.seq_models.rnn_encoder import LSTMSequenceEncoder
  from pytext.models.seq_models.rnn_encoder_decoder import RNNModel
  from pytext.models.seq_models.seq2seq_model import Seq2SeqModel
  from pytext.utils.test import import_tests_module
label_desc: Use image node_id 1 for calling the Seq2SeqModelEvalTests obj's underlying member method code with example usage: obj.test_force_predictions_on_eval() without return types