Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing arguments for Trainer compared to pytorch-lightning #2

Open
11 of 38 tasks
CarloLucibello opened this issue Feb 9, 2023 · 0 comments
Open
11 of 38 tasks

Comments

@CarloLucibello
Copy link
Owner

CarloLucibello commented Feb 9, 2023

We miss the following arguments (and corresponding functionalities) from the Trainer constructor:

  • accelerator: Supports passing different accelerator types (“cpu”, “gpu”, “tpu”, “ipu”, “hpu”, “mps”, “auto”) as well as custom accelerator instances.

  • accumulate_grad_batches: Accumulates grads every k batches or as set up in the dict.
    Default: None. [NO. users can AccumGrad as part of the optimeser chain, see add accumulate gradient #38]

  • barebones (bool) – Whether to run in “barebones mode”, where all features that may impact raw speed are disabled. This is meant for analyzing the Trainer overhead and is discouraged during regular training runs. The following features are deactivated: enable_checkpointing, logger, enable_progress_bar, log_every_n_steps, enable_model_summary, num_sanity_val_steps, fast_dev_run, detect_anomaly, profiler, log(), log_dict().

  • benchmark: The value (True or False) to set torch.backends.cudnn.benchmark to.
    The value for torch.backends.cudnn.benchmark set in the current session will be used
    (False if not manually set). If :paramref:~pytorch_lightning.trainer.Trainer.deterministic is set
    to True, this will default to False. Override to manually set a different value.
    Default: None.

  • callbacks: Add a callback or list of callbacks.
    Default: None.

  • default_root_dir (Union[str, Path, None]) – Default path for logs and weights when no logger/ckpt_callback passed. Default: os.getcwd(). Can be remote file paths such as s3://mybucket/path or ‘hdfs://path/’

  • detect_anomaly: Enable anomaly detection for the autograd engine.
    Default: False.

  • deterministic: If True, sets whether PyTorch operations must use deterministic algorithms.
    Set to "warn" to use deterministic algorithms whenever possible, throwing warnings on operations
    that don't support deterministic mode (requires PyTorch 1.11+). If not set, defaults to False.
    Default: None.

  • devices. The devices to use. Can be set to a positive number (int or str), a sequence of device indices (list or str), the value -1 to indicate all available devices should be used, or "auto" for automatic selection based on the chosen accelerator. Default: "auto".

  • enable_model_summary: Whether to enable model summarization by default.
    Default: True.

  • fast_dev_run: Runs n if set to n (int) else 1 if set to True batch(es)
    of train, val and test to find any bugs (ie: a sort of unit test).
    Default: False.

  • gradient_clip_val: The value at which to clip gradients. Passing gradient_clip_val=None disables
    gradient clipping. If using Automatic Mixed Precision (AMP), the gradients will be unscaled before.
    Default: None. [NO. This is left to Optimisers.jl, see add docs for gradient clipping #39 ]

  • gradient_clip_algorithm: The gradient clipping algorithm to use. Pass gradient_clip_algorithm="value"
    to clip by value, and gradient_clip_algorithm="norm" to clip by norm. By default it will
    be set to "norm". [NO. This is left to Optimisers.jl, see add docs for gradient clipping #39 ]

  • inference_mode: Whether to use :func:torch.inference_mode or :func:torch.no_grad during
    evaluation (validate/test/predict).

  • limit_train_batches: How much of training dataset to check (float = fraction, int = num_batches).
    Default: 1.0.

  • limit_val_batches: How much of validation dataset to check (float = fraction, int = num_batches).
    Default: 1.0.

  • limit_test_batches: How much of test dataset to check (float = fraction, int = num_batches).
    Default: 1.0.

  • limit_predict_batches: How much of prediction dataset to check (float = fraction, int = num_batches).
    Default: 1.0.

  • logger: Logger (or iterable collection of loggers) for experiment tracking. A True value uses
    the default TensorBoardLogger if it is installed, otherwise CSVLogger.
    False will disable logging. If multiple loggers are provided, local files
    (checkpoints, profiler traces, etc.) are saved in the log_dir of he first logger.
    Default: True.

  • log_every_n_steps: How often to log within steps.
    Default: 50.

  • max_epochs – Stop training once this number of epochs is reached. Disabled by default (None). If both max_epochs and max_steps are not specified, defaults to max_epochs = 1000. To enable infinite training, set max_epochs = -1.

  • max_steps – Stop training after this number of steps. Disabled by default (-1). If max_steps = -1 and max_epochs = None, will default to max_epochs = 1000. To enable infinite training, set max_epochs to -1.

  • max_time: Stop training after this amount of time has passed. Disabled by default (None).
    The time duration can be specified in the format DD:HH:MM:SS (days, hours, minutes seconds), as a
    :class:datetime.timedelta, or a dictionary with keys that will be passed to
    :class:datetime.timedelta.

  • min_epochs: Force training for at least these many epochs. Disabled by default (None).

  • min_steps: Force training for at least these number of steps. Disabled by default (None).

  • num_nodes – Number of GPU nodes for distributed training. Default: 1.

  • num_sanity_val_steps: Sanity check runs n validation batches before starting the training routine.
    Set it to -1 to run all batches in all validation dataloaders.
    Default: 2.

  • overfit_batches: Overfit a fraction of training/validation data (float) or a set number of batches (int).
    Default: 0.0.

  • plugins (Union[PrecisionPlugin, ClusterEnvironment, CheckpointIO, LayerSync, str, List[Union[PrecisionPlugin, ClusterEnvironment, CheckpointIO, LayerSync, str]], None]) – Plugins allow modification of core behavior like ddp and amp, and enable custom lightning plugins. Default: None.

  • profiler: To profile individual steps during training and assist in identifying bottlenecks.
    Default: None.

  • plugins: Plugins allow modification of core behavior like ddp and amp, and enable custom lightning plugins.
    Default: None.

  • precision: Double precision (64), full precision (32), half precision (16) or bfloat16 precision (bf16).
    Can be used on CPU, GPU, TPUs, HPUs or IPUs.
    Default: 32.

  • reload_dataloaders_every_n_epochs: Set to a non-negative integer to reload dataloaders every n epochs.
    Default: 0.

  • replace_sampler_ddp: Explicitly enables or disables sampler replacement. If not specified this
    will toggled automatically when DDP is used. By default it will add shuffle=True for
    train sampler and shuffle=False for val/test sampler. If you want to customize it,
    you can set replace_sampler_ddp=False and add your own distributed sampler.

  • strategy: Supports different training strategies with aliases
    as well custom strategies.
    Default: None.

  • sync_batchnorm: Synchronize batch norm layers between process groups/whole world.
    Default: False.

  • use_distributed_sampler – Whether to wrap the DataLoader’s sampler with torch.utils.data.DistributedSampler. If not specified this is toggled automatically for strategies that require it. By default, it will add shuffle=True for the train sampler and shuffle=False for validation/test/predict samplers. If you want to disable this logic, you can pass False and add your own distributed sampler in the dataloader hooks. If True and a distributed sampler was already added, Lightning will not replace the existing one. For iterable-style datasets, we don’t do this automatically

  • val_check_interval: How often to check the validation set. Pass a float in the range [0.0, 1.0] to check
    after a fraction of the training epoch. Pass an int to check after a fixed number of training
    batches. An int value can only be higher than the number of training batches when
    check_val_every_n_epoch=None, which validates after every N training batches
    across epochs or during iteration-based training.
    Default: 1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant