forked from facebookresearch/vissl
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FSDP Activation Checkpointing improvements (facebookresearch#176)
Summary: [enhancement] FSDP with activation checkpoint now allows to specify blocks without activations (useful for linear evaluation) and completes incomplete configurations for stage_checkpoints Pull Request resolved: fairinternal/ssl_scaling#176 Reviewed By: prigoyal Differential Revision: D30143386 Pulled By: QuentinDuval fbshipit-source-id: 6fa85059d36d0bfa44ea7c07ac92994985674943
- Loading branch information
1 parent
5a622f4
commit 554aa15
Showing
7 changed files
with
324 additions
and
54 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
configs/config/test/integration_test/models/eval_regnet_fsdp.yaml
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,19 @@ | ||
# @package _global_ | ||
config: | ||
MODEL: | ||
TRUNK: | ||
NAME: regnet | ||
REGNET: | ||
name: anynet | ||
depths: [2, 4, 11, 1] | ||
widths: [224, 448, 1232, 3024] | ||
group_widths: [112, 112, 112, 112] | ||
bottleneck_multipliers: [1.0, 1.0, 1.0, 1.0] | ||
strides: [2, 2, 2, 2] | ||
HEAD: | ||
PARAMS: [ | ||
["eval_mlp", {"in_channels": 3024, "dims": [12096, 1000]}], | ||
] | ||
SYNC_BN_CONFIG: | ||
CONVERT_BN_TO_SYNC_BN: True | ||
SYNC_BN_TYPE: pytorch |
19 changes: 19 additions & 0 deletions
19
configs/config/test/integration_test/models/swav_regnet_fsdp.yaml
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,19 @@ | ||
# @package _global_ | ||
config: | ||
MODEL: | ||
TRUNK: | ||
NAME: regnet | ||
REGNET: | ||
name: anynet | ||
depths: [2, 4, 11, 1] | ||
widths: [224, 448, 1232, 3024] | ||
group_widths: [112, 112, 112, 112] | ||
bottleneck_multipliers: [1.0, 1.0, 1.0, 1.0] | ||
strides: [2, 2, 2, 2] | ||
HEAD: | ||
PARAMS: [ | ||
["swav_head", {"dims": [3024, 3024, 128], "use_bn": False, "num_clusters": [3000]}], | ||
] | ||
SYNC_BN_CONFIG: | ||
CONVERT_BN_TO_SYNC_BN: True | ||
SYNC_BN_TYPE: pytorch |
113 changes: 113 additions & 0 deletions
113
configs/config/test/integration_test/quick_swav_2crops.yaml
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,113 @@ | ||
# @package _global_ | ||
config: | ||
VERBOSE: False | ||
LOG_FREQUENCY: 2 | ||
TEST_ONLY: False | ||
TEST_MODEL: False | ||
SEED_VALUE: 0 | ||
MULTI_PROCESSING_METHOD: forkserver | ||
HOOKS: | ||
PERF_STATS: | ||
MONITOR_PERF_STATS: True | ||
PERF_STAT_FREQUENCY: 40 | ||
ROLLING_BTIME_FREQ: 5 | ||
DATA: | ||
NUM_DATALOADER_WORKERS: 5 | ||
TRAIN: | ||
DATA_SOURCES: [disk_filelist] | ||
DATASET_NAMES: [imagenet1k_filelist] | ||
BATCHSIZE_PER_REPLICA: 16 | ||
LABEL_TYPE: sample_index # just an implementation detail. Label isn't used | ||
TRANSFORMS: | ||
- name: ImgPilToMultiCrop | ||
total_num_crops: 2 | ||
size_crops: [224] | ||
num_crops: [2] | ||
crop_scales: [[0.14, 1]] | ||
- name: RandomHorizontalFlip | ||
p: 0.5 | ||
- name: ImgPilColorDistortion | ||
strength: 1.0 | ||
- name: ImgPilGaussianBlur | ||
p: 0.5 | ||
radius_min: 0.1 | ||
radius_max: 2.0 | ||
- name: ToTensor | ||
- name: Normalize | ||
mean: [0.485, 0.456, 0.406] | ||
std: [0.229, 0.224, 0.225] | ||
COLLATE_FUNCTION: multicrop_collator | ||
MMAP_MODE: True | ||
COPY_TO_LOCAL_DISK: False | ||
COPY_DESTINATION_DIR: /tmp/imagenet1k/ | ||
DATA_LIMIT: 250 | ||
DROP_LAST: True | ||
TRAINER: | ||
TRAIN_STEP_NAME: standard_train_step | ||
METERS: | ||
name: "" | ||
MODEL: | ||
TRUNK: | ||
NAME: resnet | ||
RESNETS: | ||
DEPTH: 50 | ||
HEAD: | ||
PARAMS: [ | ||
["swav_head", {"dims": [2048, 2048, 128], "use_bn": True, "num_clusters": [3000]}], | ||
] | ||
TEMP_FROZEN_PARAMS_ITER_MAP: [ | ||
['module.heads.0.prototypes0.weight', 313], | ||
# TODO (Min): FSDP need to return the original param name from named_parameters(). | ||
['_fsdp_wrapped_module.heads.0._fsdp_wrapped_module._fpw_module.prototypes0._fsdp_wrapped_module.weight', 313] | ||
] | ||
SYNC_BN_CONFIG: | ||
CONVERT_BN_TO_SYNC_BN: True | ||
SYNC_BN_TYPE: pytorch | ||
LOSS: | ||
name: swav_loss | ||
swav_loss: | ||
temperature: 0.1 | ||
use_double_precision: False | ||
normalize_last_layer: True | ||
num_iters: 3 | ||
epsilon: 0.05 | ||
crops_for_assign: [0, 1] | ||
queue: | ||
queue_length: 0 | ||
start_iter: 0 | ||
OPTIMIZER: | ||
name: sgd | ||
use_larc: True | ||
larc_config: | ||
clip: False | ||
trust_coefficient: 0.001 | ||
eps: 0.00000001 | ||
weight_decay: 0.000001 | ||
momentum: 0.9 | ||
nesterov: False | ||
num_epochs: 1 | ||
regularize_bn: True | ||
regularize_bias: True | ||
param_schedulers: | ||
lr: | ||
auto_lr_scaling: | ||
auto_scale: true | ||
base_value: 0.3 | ||
base_lr_batch_size: 256 | ||
name: cosine | ||
start_value: 0.15 # LR for batch size 256 | ||
end_value: 0.0000 | ||
update_interval: step | ||
DISTRIBUTED: | ||
BACKEND: nccl | ||
NUM_NODES: 1 | ||
NUM_PROC_PER_NODE: 2 | ||
INIT_METHOD: tcp | ||
RUN_ID: auto | ||
MACHINE: | ||
DEVICE: gpu | ||
CHECKPOINT: | ||
DIR: "." | ||
AUTO_RESUME: True | ||
CHECKPOINT_FREQUENCY: 5 | ||
OVERWRITE_EXISTING: true |
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
Oops, something went wrong.