-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separate out dataclass to torchsnapshot_saver_types.py (#614)
Summary: Pull Request resolved: #614 This allows importing just the dataclass w/o depending on all of torchsnapshot - use case for things like CLIs Reviewed By: galrotem Differential Revision: D51139173 fbshipit-source-id: 472079502c625fc1ed3c073b00af46058da3330f
- Loading branch information
1 parent
206f58a
commit 08dad27
Showing
2 changed files
with
42 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
from dataclasses import dataclass | ||
from typing import Optional | ||
|
||
# TODO: eventually support overriding all knobs | ||
@dataclass | ||
class KnobOptions: | ||
""" | ||
Controls the knobs in TorchSnapshot. | ||
Args: | ||
max_per_rank_io_concurrency: Maximum number of concurrent IO operations per rank. Defaults to 16. | ||
""" | ||
|
||
max_per_rank_io_concurrency: Optional[int] = None | ||
|
||
|
||
@dataclass | ||
class RestoreOptions: | ||
""" | ||
Options when restoring a snapshot. | ||
Args: | ||
restore_train_progress: Whether to restore the training progress state. | ||
restore_eval_progress: Whether to restore the evaluation progress state. | ||
restore_optimizers: Whether to restore the optimizer states. | ||
restore_lr_schedulers: Whether to restore the lr scheduler states. | ||
""" | ||
|
||
restore_train_progress: bool = True | ||
restore_eval_progress: bool = True | ||
restore_optimizers: bool = True | ||
restore_lr_schedulers: bool = True |