class_docstr: Forecaster base model for lstm, seq2seq, tcn and nbeats forecasters.
class_docstr_tok: ["Forecaster","base","model","for","lstm",",","seq2seq",",","tcn","and","nbeats","forecasters","."]
code: def __init__(self, **kwargs):
      self.internal = None
      if self.distributed:
          # don't support use_hpo when distributed
          self.use_hpo = False
          from bigdl.orca.learn.pytorch.estimator import Estimator
          from bigdl.orca.learn.metrics import MSE, MAE
  
          ORCA_METRICS = {"mse": MSE, "mae": MAE}
  
          def model_creator_orca(config):
              set_pytorch_seed(self.seed)
              model = self.model_creator(
                  {**self.model_config, **self.data_config}
              )
              model.train()
              return model
  
          self.internal = Estimator.from_torch(
              model=model_creator_orca,
              optimizer=self.optimizer_creator,
              loss=self.loss_creator,
              metrics=[ORCA_METRICS[name]() for name in self.metrics],
              backend=self.remote_distributed_backend,
              use_tqdm=True,
              config={"lr": self.lr},
              workers_per_node=self.workers_per_node,
          )
      else:
          # seed setting
          from pytorch_lightning import seed_everything
          from bigdl.chronos.pytorch import TSTrainer as Trainer
  
          seed_everything(seed=self.seed)
  
          # Model preparation
          self.fitted = False
  
          has_space = _config_has_search_space(
              config={
                  **self.model_config,
                  **self.optim_config,
                  **self.loss_config,
                  **self.data_config,
              }
          )
  
          if not self.use_hpo and has_space:
              invalidInputError(
                  False,
                  "Found search spaces in arguments but HPO is disabled."
                  "Enable HPO or remove search spaces in arguments to use.",
              )
  
          if not has_space:
              self.use_hpo = False
              model = self.model_creator(
                  {**self.model_config, **self.data_config}
              )
              loss = self.loss_creator(self.loss_config)
              optimizer = self.optimizer_creator(
                  model, self.optim_config
              )
              self.internal = Trainer.compile(
                  model=model, loss=loss, optimizer=optimizer
              )
  
          self.accelerated_model = None  # accelerated model obtained from various accelerators
          self.accelerate_method = (
              None  # str indicates current accelerate method
          )
          self.cxt_manager = DummyForecasterContextManager()
          self.context_enabled = False
  
imports: from bigdl.chronos.forecaster.abstract import Forecaster
  from bigdl.chronos.forecaster.utils import *
  from bigdl.chronos.metric.forecast_metrics import Evaluator
  from typing import Optional
  import numpy
  import warnings
  import os
  from tempfile import TemporaryDirectory
  import torch
  from torch.utils.data import TensorDataset, DataLoader
  from .utils_hpo import GenericLightningModule, _format_metric_str, _config_has_search_space
  from bigdl.nano.utils.common import invalidOperationError, invalidInputError
  from bigdl.chronos.data.tsdataset import TSDataset
  from bigdl.chronos.pytorch.context_manager import DummyForecasterContextManager, ForecasterContextManager
  from bigdl.chronos.pytorch.utils import _pytorch_fashion_inference
label_desc: Use image node_id 1 to create a new BasePytorchForecaster object from inherited base classes: Forecaster with example: obj = BasePytorchForecaster()