original_docstring: 
      Load a trained model, along with its optimizer
      Args:
          name (str): the name of the model
          path (str): the directory, in which the model is saved
  
      Returns:
          model, optimizer
  
      
docstring: Load a trained model, along with its optimizer
docstring_tokens: Load a trained model along with its optimizer
code: def load_checkpoint(name, path=None):
      """
      Load a trained model, along with its optimizer
      Args:
          name (str): the name of the model
          path (str): the directory, in which the model is saved
  
      Returns:
          model, optimizer
  
      """
      if path is None:
          path = TRAINED_PATH
  
      # model_fname = os.path.join(path, "{}.pt".format(name))
      try:
          model_fname = os.path.join(path, name)
          print("Loading checkpoint `{}` ...".format(model_fname), end=" ")
          with open(model_fname, 'rb') as f:
              state = torch.load(f, map_location="cpu")
          print("done!")
      except:
          print("Loading checkpoint `{}` ...".format(name), end=" ")
          with open(name, 'rb') as f:
              state = torch.load(f, map_location="cpu")
          print("done!")
  
      if "vocab" in state:
          if isinstance(state["vocab"], tuple):
              state["vocab"] = tuple(Vocab().from_vocab_instance(v)
                                     for v in state["vocab"])
          else:
              state["vocab"] = Vocab().from_vocab_instance(state["vocab"])
  
      return state
code_tokens: def load_checkpoint ( name , path = None ) : if path is None : path = TRAINED_PATH try : model_fname = os . path . join ( path , name ) print ( "Loading checkpoint `{}` ..." . format ( model_fname ) , end = " " ) with open ( model_fname , 'rb' ) as f : state = torch . load ( f , map_location = "cpu" ) print ( "done!" ) except : print ( "Loading checkpoint `{}` ..." . format ( name ) , end = " " ) with open ( name , 'rb' ) as f : state = torch . load ( f , map_location = "cpu" ) print ( "done!" ) if "vocab" in state : if isinstance ( state [ "vocab" ] , tuple ) : state [ "vocab" ] = tuple ( Vocab ( ) . from_vocab_instance ( v ) for v in state [ "vocab" ] ) else : state [ "vocab" ] = Vocab ( ) . from_vocab_instance ( state [ "vocab" ] ) return state
short_docstring: Load a trained model, along with its optimizer
short_docstring_tokens: Load a trained model along with its optimizer
comment: """
      Load a trained model, along with its optimizer
      Args:
          name (str): the name of the model
          path (str): the directory, in which the model is saved
  
      Returns:
          model, optimizer
  
      """$SEP$# model_fname = os.path.join(path, "{}.pt".format(name))