class_docstr: Wrapper Class to run Inference.
  
  Args:
      opt: inference options
class_docstr_tok: ["Wrapper","Class","to","run","Inference",".","Args",":","opt",":","inference","options"]
docstr: File scoring. Source file must be the opt.src argument
docstr_tok: ["File","scoring",".","Source","file","must","be","the","opt.src","argument"]
code: def score_file(self):
      """File scoring. Source file must be the opt.src argument"""
      if self.opt.world_size <= 1:
          infer_iter = build_dynamic_dataset_iter(
              self.opt,
              self.transforms_cls,
              self.vocabs,
              task=CorpusTask.INFER,
              device_id=self.device_id,
              tgt=self.opt.src,
          )
          score_results = self._score(infer_iter)
      else:
          score_results = self.score_file_parallel()
      return score_results
  
imports: import json
  from onmt.constants import CorpusTask, DefaultTokens, ModelTask
  from onmt.inputters.dynamic_iterator import build_dynamic_dataset_iter
  from onmt.utils.distributed import ErrorHandler, spawned_infer
  from onmt.utils.logging import init_logger
  from onmt.transforms import get_transforms_cls, make_transforms, TransformPipe
label_desc: Use image node_id 9 for calling the InferenceEngine obj's underlying member method code with example usage: obj.score_file() and returns: score_results