class_docstr: Inference engine subclass to run inference with `translate.py`.
  
  Args:
      opt: inference options
class_docstr_tok: ["Inference","engine","subclass","to","run","inference","with","`","translate.py","`",".","Args",":","opt",":","inference","options"]
code: def terminate(self):
      if self.opt.world_size > 1:
          for device_id in range(self.opt.world_size):
              self.queue_instruct[device_id].put(("stop"))
              self.procs[device_id].terminate()
  
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 8 for calling the InferenceEnginePY obj's underlying member method code with example usage: obj.terminate() without return types