phlower.settings.PhlowerPredictorSetting

class phlower.settings.PhlowerPredictorSetting(*, selection_mode, device='cpu', log_file_name='log', saved_setting_filename='model', batch_size=1, num_workers=0, non_blocking=False, pin_memory=False, random_seed=0, target_epoch=None, output_to_scaler_name=<factory>, use_inference_mode=True)[source]

Bases: BaseModel

Methods

check_valid_selection_mode(name)

check_valid_target_epoch()

Attributes

model_computed_fields

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_extra

Get extra fields set during validation.

model_fields

model_fields_set

Returns the set of fields that have been explicitly set on this model instance.

selection_mode

Define method to select checkpoint file.

device

device name.

log_file_name

name of log file.

saved_setting_filename

file name of pretrained model setting.

batch_size

batch size.

num_workers

the number of cores.

non_blocking

If True, the data transfer is non-blocking.

pin_memory

If True, the data loader uses pin_memory.

random_seed

random seed.

target_epoch

target_epoch specifies the number of snapshot.

output_to_scaler_name

output_to_scaler_name is a dictionary to define the scaler

use_inference_mode

If True, use torch.inference_mode() for prediction.

Parameters:
  • selection_mode (str)

  • device (str)

  • log_file_name (str)

  • saved_setting_filename (str)

  • batch_size (int)

  • num_workers (int)

  • non_blocking (bool)

  • pin_memory (bool)

  • random_seed (int)

  • target_epoch (int | None)

  • output_to_scaler_name (dict[str, str])

  • use_inference_mode (bool)

batch_size: int

batch size. Defaults to 1

device: str

device name. Defaults to cpu

log_file_name: str

name of log file. Defaults to “log”

model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

non_blocking: bool

If True, the data transfer is non-blocking. Defaults to False.

num_workers: int

the number of cores. Defaults to 0

output_to_scaler_name: dict[str, str]
output_to_scaler_name is a dictionary to define the scaler

for each output variable. The key is the name of the output variable

and the value is the name of variable which has the scaler to use. Defaults to empty dictionary, relationship between output variable

and scaler is assumed to be the same as that of label variables.

pin_memory: bool

If True, the data loader uses pin_memory. Defaults to False.

random_seed: int

random seed. Defaults to 0

saved_setting_filename: str

file name of pretrained model setting. Defaults to “model”

selection_mode: str

Define method to select checkpoint file. Choose from “best”, “latest”, “train_best”, “specified”

target_epoch: int | None

target_epoch specifies the number of snapshot. Defaults to None.

use_inference_mode: bool

If True, use torch.inference_mode() for prediction. Defaults to True.