class_docstr: A subclass of :class:`~allennlp.common.testing.test_case.AllenNlpTestCase`
  with added methods for testing :class:`~allennlp.models.model.Model` subclasses.
class_docstr_tok: ["A","subclass","of",":","class",":","`","~allennlp.common.testing.test_case.AllenNlpTestCase","`","with","added","methods","for","testing",":","class",":","`","~allennlp.models.model.Model","`","subclasses","."]
code: def set_up_model(self, param_file, dataset_file):
      # pylint: disable=attribute-defined-outside-init
      self.param_file = param_file
      params = Params.from_file(self.param_file)
  
      reader = DatasetReader.from_params(params["dataset_reader"])
      instances = reader.read(dataset_file)
      # Use parameters for vocabulary if they are present in the config file, so that choices like
      # "non_padded_namespaces", "min_count" etc. can be set if needed.
      if "vocabulary" in params:
          vocab_params = params["vocabulary"]
          vocab = Vocabulary.from_params(
              params=vocab_params, instances=instances
          )
      else:
          vocab = Vocabulary.from_instances(instances)
      self.vocab = vocab
      self.instances = instances
      self.model = Model.from_params(
          vocab=self.vocab, params=params["model"]
      )
  
      # TODO(joelgrus) get rid of these
      # (a lot of the model tests use them, so they'll have to be changed)
      self.dataset = Batch(self.instances)
      self.dataset.index_instances(self.vocab)
  
file_path: magnitude/pymagnitude/third_party/allennlp/common/testing/model_test_case.py
imports: from __future__ import division
  from __future__ import absolute_import
  from __future__ import print_function
  import copy
  from numpy.testing import assert_allclose
  import torch
  from allennlp.commands.train import train_model_from_file
  from allennlp.common import Params
  from allennlp.common.testing.test_case import AllenNlpTestCase
  from allennlp.data import DataIterator, DatasetReader, Vocabulary
  from allennlp.data.dataset import Batch
  from allennlp.models import Model, load_archive
label_desc: Use image node_id 1 for calling the ModelTestCase obj's underlying member method code with example usage: obj.set_up_model(param_file, dataset_file) without return types