Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit 5f76155

Browse files
committed
BYOL improvements
1 parent 6e3063d commit 5f76155

13 files changed

+129
-661
lines changed

configs/config/benchmark/linear_image_classification/imagenet1k/byol_transfer_in1k_linear.yaml

+17-8
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ config:
2222
TRANSFORMS:
2323
- name: RandomResizedCrop
2424
size: 224
25+
interpolation: 3
2526
- name: RandomHorizontalFlip
2627
- name: ToTensor
2728
- name: Normalize
@@ -38,6 +39,7 @@ config:
3839
TRANSFORMS:
3940
- name: Resize
4041
size: 256
42+
interpolation: 3
4143
- name: CenterCrop
4244
size: 224
4345
- name: ToTensor
@@ -82,7 +84,7 @@ config:
8284
PARAMS_FILE: "specify the model weights"
8385
STATE_DICT_KEY_NAME: classy_state_dict
8486
SYNC_BN_CONFIG:
85-
CONVERT_BN_TO_SYNC_BN: True
87+
CONVERT_BN_TO_SYNC_BN: False
8688
SYNC_BN_TYPE: apex
8789
GROUP_SIZE: 8
8890
LOSS:
@@ -93,22 +95,29 @@ config:
9395
name: sgd
9496
momentum: 0.9
9597
num_epochs: 80
98+
weight_decay: 0
9699
nesterov: True
97100
regularize_bn: False
98101
regularize_bias: True
99102
param_schedulers:
100103
lr:
101104
auto_lr_scaling:
102-
auto_scale: true
103-
base_value: 0.4
105+
# if set to True, learning rate will be scaled.
106+
auto_scale: True
107+
# base learning rate value that will be scaled.
108+
base_value: 0.2
109+
# batch size for which the base learning rate is specified. The current batch size
110+
# is used to determine how to scale the base learning rate value.
111+
# scaled_lr = ((batchsize_per_gpu * world_size) * base_value ) / base_lr_batch_size
104112
base_lr_batch_size: 256
105-
name: multistep
106-
values: [0.4, 0.3, 0.2, 0.1, 0.05]
107-
milestones: [16, 32, 48, 64]
108-
update_interval: epoch
113+
# scaling_type can be set to "sqrt" to reduce the impact of scaling on the base value
114+
scaling_type: "linear"
115+
name: constant
116+
update_interval: "epoch"
117+
value: 0.2
109118
DISTRIBUTED:
110119
BACKEND: nccl
111-
NUM_NODES: 8
120+
NUM_NODES: 4
112121
NUM_PROC_PER_NODE: 8
113122
INIT_METHOD: tcp
114123
RUN_ID: auto

configs/config/dataset_catalog.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"val": ["airstore://flashblade_imagenet_val", "<unused>"]
55
},
66
"imagenet1k_folder": {
7-
"train": ["/datasets01/imagenet_full_size/061417/train", "/datasets01/imagenet_full_size/061417/train"],
8-
"val": ["/datasets01/imagenet_full_size/061417/val", "/datasets01/imagenet_full_size/061417/val"]
7+
"train": ["<img_path>", "<lbl_path>"],
8+
"val": ["<img_path>", "<lbl_path>"]
99
},
1010
"imagenet_a_filelist": {
1111
"train": ["<not_used>", "<not_used>"],

configs/config/pretrain/byol/byol_1node_resnet.yaml

-113
This file was deleted.

configs/config/pretrain/byol/byol_8node_resnet.yaml

+5-4
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ config:
6767
RESNETS:
6868
DEPTH: 50
6969
ZERO_INIT_RESIDUAL: True
70-
HEAD:
70+
HEAD:
7171
PARAMS: [
7272
["mlp", {"dims": [2048, 4096, 256], "use_relu": True, "use_bn": True}],
7373
["mlp", {"dims": [256, 4096, 256], "use_relu": True, "use_bn": True}]
@@ -82,15 +82,16 @@ config:
8282
byol_loss:
8383
embedding_dim: 256
8484
momentum: 0.99
85-
OPTIMIZER: # from official BYOL implementation, deepmind-research/byol/configs/byol.py
85+
OPTIMIZER:
8686
name: lars
87-
trust_coefficient: 0.001
87+
eta: 0.001
8888
weight_decay: 1.0e-6
8989
momentum: 0.9
9090
nesterov: False
9191
num_epochs: 300
9292
regularize_bn: False
93-
regularize_bias: True
93+
regularize_bias: False
94+
exclude_bias_and_norm: True
9495
param_schedulers:
9596
lr:
9697
auto_lr_scaling:

configs/config/quick_1gpu_resnet50_byol.yaml

-135
This file was deleted.

0 commit comments

Comments
 (0)