class_docstr: Forecaster base model for lstm, mtnet, seq2seq and tcn forecasters.
class_docstr_tok: ["Forecaster","base","model","for","lstm",",","mtnet",",","seq2seq","and","tcn","forecasters","."]
docstr: Transform a distributed forecaster to a local (non-distributed) one.
  
  Common practice is to use distributed training (fit) and predict/
  evaluate with onnx or other frameworks on a single node. To do so,
  you need to call .to_local() and transform the forecaster to a non-
  distributed one.
  
  The optimizer is refreshed, incremental training after to_local
  might have some problem.
  
  :return: a forecaster instance.
docstr_tok: ["Transform","a","distributed","forecaster","to","a","local","(","non-distributed",")","one",".","Common","practice","is","to","use","distributed","training","(","fit",")","and","predict\/","evaluate","with","onnx","or","other","frameworks","on","a","single","node",".","To","do","so",",","you","need","to","call",".to_local","(",")","and","transform","the","forecaster","to","a","non-","distributed","one",".","The","optimizer","is","refreshed",",","incremental","training","after","to_local","might","have","some","problem",".",":","return",":","a","forecaster","instance","."]
code: def to_local(self):
      """
      Transform a distributed forecaster to a local (non-distributed) one.
  
      Common practice is to use distributed training (fit) and predict/
      evaluate with onnx or other frameworks on a single node. To do so,
      you need to call .to_local() and transform the forecaster to a non-
      distributed one.
  
      The optimizer is refreshed, incremental training after to_local
      might have some problem.
  
      :return: a forecaster instance.
      """
      # TODO: optimizer is refreshed, which is not reasonable
      if not self.distributed:
          raise RuntimeError("The forecaster has become local.")
      model = self.internal.get_model()
      state = {
          "config": {**self.data_config, **self.config},
          "model": model.state_dict(),
          "optimizer": self.optimizer_creator(
              model, {"lr": self.config["lr"]}
          ).state_dict(),
      }
      self.internal.shutdown()
      self.internal = self.local_model(check_optional_config=False)
      self.internal.load_state_dict(state)
      self.distributed = False
      return self
  
file_path: analytics-zoo/pyzoo/zoo/chronos/forecaster/base_forecaster.py
imports: from zoo.chronos.forecaster.abstract import Forecaster
  from zoo.orca.data.shard import SparkXShards
  from zoo.chronos.forecaster.utils import np_to_creator, set_pytorch_seed, check_data, xshard_to_np, np_to_xshard
  import numpy
  from zoo.orca.learn.pytorch.estimator import Estimator
  from zoo.orca.learn.metrics import MSE, MAE
label_desc: Use image node_id 9 for calling the BasePytorchForecaster obj's underlying member method code with example usage: obj.to_local() and returns: self