phlower.settings.PhlowerTrainerSetting

class phlower.settings.PhlowerTrainerSetting(*, loss_setting, optimizer_setting=None, scheduler_setting=None, n_epoch=10, random_seed=0, batch_size=1, num_workers=1, device='cpu', non_blocking=False)[source]

Bases: BaseModel

Methods

Attributes

model_computed_fields

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

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

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

model_fields_set

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

loss_setting

setting for loss function

optimizer_setting

setting for optimizer

scheduler_setting

setting for schedulers

n_epoch

the number of epochs.

random_seed

random seed.

batch_size

batch size.

num_workers

the number of cores.

device

device name.

non_blocking

Parameters:
  • loss_setting (LossSetting)

  • optimizer_setting (OptimizerSetting)

  • scheduler_setting (list[SchedulerSetting])

  • n_epoch (int)

  • random_seed (int)

  • batch_size (int)

  • num_workers (int)

  • device (str)

  • non_blocking (bool)

batch_size: int

batch size. Defaults to 1

device: str

device name. Defaults to cpu

loss_setting: LossSetting

setting for loss function

model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

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

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

model_fields: ClassVar[Dict[str, FieldInfo]] = {'batch_size': FieldInfo(annotation=int, required=False, default=1), 'device': FieldInfo(annotation=str, required=False, default='cpu'), 'loss_setting': FieldInfo(annotation=LossSetting, required=True), 'n_epoch': FieldInfo(annotation=int, required=False, default=10), 'non_blocking': FieldInfo(annotation=bool, required=False, default=False), 'num_workers': FieldInfo(annotation=int, required=False, default=1), 'optimizer_setting': FieldInfo(annotation=OptimizerSetting, required=False, default_factory=OptimizerSetting), 'random_seed': FieldInfo(annotation=int, required=False, default=0), 'scheduler_setting': FieldInfo(annotation=list[SchedulerSetting], required=False, default_factory=list)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

n_epoch: int

the number of epochs. Defaults to 10.

num_workers: int

the number of cores. Defaults to 1.

optimizer_setting: OptimizerSetting

setting for optimizer

random_seed: int

random seed. Defaults to 0

scheduler_setting: list[SchedulerSetting]

setting for schedulers