Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
# -----------------------------------------------------------------------------
_C.TRAIN = CN()
_C.TRAIN.START_EPOCH = 0
_C.TRAIN.EPOCHS = 300
_C.TRAIN.EPOCHS = 90
_C.TRAIN.WARMUP_EPOCHS = 20
_C.TRAIN.WEIGHT_DECAY = 0.05
_C.TRAIN.BASE_LR = 5e-4
Expand Down
2 changes: 1 addition & 1 deletion models/swin_transformer_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def forward(self, x, mask=None):

# cosine attention
attn = (F.normalize(q, dim=-1) @ F.normalize(k, dim=-1).transpose(-2, -1))
logit_scale = torch.clamp(self.logit_scale, max=torch.log(torch.tensor(1. / 0.01))).exp()
logit_scale = torch.clamp(self.logit_scale, max=torch.log(torch.tensor(1. / 0.01, device = "cuda"))).exp()
attn = attn * logit_scale

relative_position_bias_table = self.cpb_mlp(self.relative_coords_table).view(-1, self.num_heads)
Expand Down
2 changes: 1 addition & 1 deletion train.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
horovodrun -np 4 python main_hvd.py --cfg configs/swinv2/swinv2_base_patch4_window8_128_hvd.yaml --data-path ../../datasets/tiny-imagenet-200 --batch-size 64 --disable_amp --local_rank 0
horovodrun -np 8 python main_hvd.py --cfg configs/swinv2/swinv2_base_patch4_window8_128_hvd.yaml --data-path ../tiny-imagenet-200 --batch-size 32 --disable_amp --local_rank 0