[docs]classPhlowerPredictorSetting(pydantic.BaseModel):selection_mode:str""" Define method to select checkpoint file. Choose from "best", "latest", "train_best", "specified" """device:str="cpu"""" device name. Defaults to cpu """log_file_name:str="log"""" name of log file. Defaults to "log" """saved_setting_filename:str="model"""" file name of pretrained model setting. Defaults to "model" """batch_size:int=1""" batch size. Defaults to 1 """num_workers:int=0""" the number of cores. Defaults to 0 """non_blocking:bool=Falserandom_seed:int=0""" random seed. Defaults to 0 """target_epoch:int|None=None""" target_epoch specifies the number of snapshot. Defaults to None. """output_to_scaler_name:dict[str,str]=pydantic.Field(default_factory=dict)""" 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. """# special keyward to forbid extra fields in pydanticmodel_config=pydantic.ConfigDict(frozen=True,extra="forbid")@pydantic.field_validator("selection_mode")@classmethoddefcheck_valid_selection_mode(cls,name:str)->str:names=[v.valueforvinModelSelectionType]ifnamenotinnames:raiseValueError(f"{name} selection mode does not exist.")returnname@pydantic.model_validator(mode="after")defcheck_valid_target_epoch(self)->Self:ifself.selection_mode!="specified":ifself.target_epochisnotNone:raiseValueError("target_epoch should be None ""if selection_mode is not `specified` "f"but {self.target_epoch}")returnselfif(self.target_epochisNone)or(self.target_epoch<0):raiseValueError("target_epoch should be non-negative value "f"when selection_mode = {self.selection_mode}, "f"but {self.target_epoch}")returnself