class_docstr: Provides methods that implement functionality of route guide server.
class_docstr_tok: ["Provides","methods","that","implement","functionality","of","route","guide","server","."]
code: def _load_model(self, model_path):
      if model_path.endswith(".nemo"):
          logging.info("Attempting to initialize from .nemo file")
          model = nemo_nlp.models.machine_translation.MTEncDecModel.restore_from(
              restore_path=model_path
          )
          model = model.eval()
          model.beam_search.beam_size = self._beam_size
          model.beam_search.len_pen = self._len_pen
          model.beam_search.max_delta_length = self._max_delta_length
          if torch.cuda.is_available():
              model = model.cuda()
      else:
          raise NotImplemented(
              f"Only support .nemo files, but got: {model_path}"
          )
  
      if not hasattr(model, "src_language") or not hasattr(
          model, "tgt_language"
      ):
          raise ValueError(
              f"Could not find src_language and tgt_language in model attributes. If using NeMo rc1 checkpoints, please edit the config files to add model.src_language and model.tgt_language"
          )
  
      src_language = model.src_language
      tgt_language = model.tgt_language
  
      if src_language not in self._models:
          self._models[src_language] = {}
  
      if tgt_language not in self._models[src_language]:
          self._models[src_language][tgt_language] = model
          if torch.cuda.is_available():
              self._models[src_language][tgt_language] = self._models[
                  src_language
              ][tgt_language].cuda()
      else:
          raise ValueError(
              f"Already found model for language pair {src_language}-{tgt_language}"
          )
  
file_path: NeMo/tools/nmt_grpc_service/server.py
imports: import argparse
  import os
  from concurrent import futures
  import api.nmt_pb2
  import api.nmt_pb2_grpc
  import grpc
  import torch
  import nemo.collections.nlp
  from nemo.utils import logging
label_desc: Use image node_id 3 for calling the RivaTranslateServicer obj's underlying member method code with example usage: obj._load_model(model_path) without return types