Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
陈科研 committed Nov 26, 2023
1 parent 4c732b4 commit b51e916
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 152 deletions.
21 changes: 13 additions & 8 deletions README_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -333,14 +333,19 @@ python zero_to_fp32.py . $SAVE_CHECKPOINT_NAME -t $CHECKPOINT_DIR # $SAVE_CHECK

这里我们列出了使用不同模型的资源消耗情况,供您参考。

| 模型名称 | 骨干网络类型 | 图像尺寸 | GPU | Batch Size | 加速策略 | 单卡显存占用 |
|:---------------------:|:--------:| :------: |:---------------:|:-----------:|:----------------:|:-------:|
| SAM-seg (Mask R-CNN) | ViT-B/16 | 1024x1024 | 1x RTX 4090 | 8 | AMP FP16 | 19.4 GB |
| SAM-seg (Mask2Former) | ViT-B/16 | 1024x1024 | 1x RTX 4090 | 8 | AMP FP16 | 21.5 GB |
| SAM-det | ResNet50 | 1024x1024 | 1x RTX 4090 | 8 | FP32 | 16.6 GB |
| RSPrompter-anchor | ViT-B/16 | 1024x1024 | 1x RTX 4090 | 2 | AMP FP16 | 20.9 GB |
| RSPrompter-query | ViT-B/16 | 1024x1024 | 1x RTX 4090 | 1 | AMP FP16 | OOM |
| RSPrompter-anchor | ViT-B/16 | 1024x1024 | 1 | 8x RTX 4090 | DeepSpeed ZeRO-2 | 2.4 GB |
| 模型名称 | 骨干网络类型 | 图像尺寸 | GPU | Batch Size | 加速策略 | 单卡显存占用 |
|:---------------------:|:--------:| :------: |:------------------------:|:----------:|:----------------:|:-------:|
| SAM-seg (Mask R-CNN) | ViT-B/16 | 1024x1024 | 1x RTX 4090 | 8 | AMP FP16 | 19.4 GB |
| SAM-seg (Mask2Former) | ViT-B/16 | 1024x1024 | 1x RTX 4090 | 8 | AMP FP16 | 21.5 GB |
| SAM-det | ResNet50 | 1024x1024 | 1x RTX 4090 | 8 | FP32 | 16.6 GB |
| RSPrompter-anchor | ViT-B/16 | 1024x1024 | 1x RTX 4090 | 2 | AMP FP16 | 20.9 GB |
| RSPrompter-query | ViT-B/16 | 1024x1024 | 1x RTX 4090 | 1 | AMP FP16 | OOM |
| RSPrompter-anchor | ViT-B/16 | 1024x1024 | 8x RTX 4090 | 4 | DeepSpeed ZeRO-2 | 2.4 GB |


### 4. dist_train.sh: Bad substitution的解决

如果您在运行`dist_train.sh`时出现了`Bad substitution`的错误,请使用`bash dist_train.sh`来运行脚本。


</details>
Expand Down
43 changes: 0 additions & 43 deletions configs/rsprompter/_base_/rsprompter_anchor.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,49 +313,6 @@
]


# runner_type = 'FlexibleRunner'
# strategy = dict(
# type='DeepSpeedStrategy',
# fp16=dict(
# enabled=True,
# auto_cast=False,
# fp16_master_weights_and_grads=False,
# loss_scale=0,
# loss_scale_window=500,
# hysteresis=2,
# min_loss_scale=1,
# initial_scale_power=15,
# ),
# inputs_to_half=['inputs'],
# zero_optimization=dict(
# stage=2,
# allgather_partitions=True,
# allgather_bucket_size=2e8,
# reduce_scatter=True,
# reduce_bucket_size='auto',
# overlap_comm=True,
# contiguous_gradients=True,
# ),
# )
#
# optim_wrapper = dict(
# type='DeepSpeedOptimWrapper',
# optimizer=dict(
# type='AdamW',
# lr=base_lr,
# weight_decay=0.05
# )
# )

optim_wrapper = dict(
type='AmpOptimWrapper',
dtype='float16',
optimizer=dict(
type='AdamW',
lr=base_lr,
weight_decay=0.05)
)

# Default setting for scaling LR automatically
# - `enable` means enable scaling LR automatically
# or not by default.
Expand Down
36 changes: 0 additions & 36 deletions configs/rsprompter/_base_/rsprompter_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,42 +314,6 @@
)
]


runner_type = 'FlexibleRunner'
strategy = dict(
type='DeepSpeedStrategy',
fp16=dict(
enabled=True,
auto_cast=False,
fp16_master_weights_and_grads=False,
loss_scale=0,
loss_scale_window=500,
hysteresis=2,
min_loss_scale=1,
initial_scale_power=15,
),
gradient_clipping=0.1,
inputs_to_half=['inputs'],
zero_optimization=dict(
stage=2,
allgather_partitions=True,
allgather_bucket_size=2e8,
reduce_scatter=True,
reduce_bucket_size='auto',
overlap_comm=True,
contiguous_gradients=True,
),
)

optim_wrapper = dict(
type='DeepSpeedOptimWrapper',
optimizer=dict(
type='AdamW',
lr=base_lr,
weight_decay=0.05
)
)

# Default setting for scaling LR automatically
# - `enable` means enable scaling LR automatically
# or not by default.
Expand Down
10 changes: 0 additions & 10 deletions configs/rsprompter/_base_/samdet.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,16 +270,6 @@
)
]

optim_wrapper = dict(
type='OptimWrapper',
optimizer=dict(
type='AdamW',
lr=base_lr,
weight_decay=0.05,
eps=1e-8,
betas=(0.9, 0.999))
)

# Default setting for scaling LR automatically
# - `enable` means enable scaling LR automatically
# or not by default.
Expand Down
46 changes: 0 additions & 46 deletions configs/rsprompter/_base_/samseg-mask2former.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,52 +304,6 @@
)
]

runner_type = 'FlexibleRunner'
strategy = dict(
type='DeepSpeedStrategy',
fp16=dict(
enabled=True,
auto_cast=False,
fp16_master_weights_and_grads=False,
loss_scale=0,
loss_scale_window=500,
hysteresis=2,
min_loss_scale=1,
initial_scale_power=15,
),
gradient_clipping=0.1,
inputs_to_half=['inputs'],
zero_optimization=dict(
stage=2,
allgather_partitions=True,
allgather_bucket_size=2e8,
reduce_scatter=True,
reduce_bucket_size='auto',
overlap_comm=True,
contiguous_gradients=True,
),
)
optim_wrapper = dict(
type='DeepSpeedOptimWrapper',
optimizer=dict(
type='AdamW',
lr=base_lr,
weight_decay=0.05
)
)

# runner_type = 'Runner'
# optim_wrapper = dict(
# type='AmpOptimWrapper',
# dtype='float16',
# optimizer=dict(
# type='AdamW',
# lr=base_lr,
# weight_decay=0.05,
# eps=1e-8,
# betas=(0.9, 0.999))
# )

# Default setting for scaling LR automatically
# - `enable` means enable scaling LR automatically
# or not by default.
Expand Down
9 changes: 0 additions & 9 deletions configs/rsprompter/_base_/samseg-maskrcnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,15 +290,6 @@

find_unused_parameters = True

optim_wrapper = dict(
type='AmpOptimWrapper',
dtype='float16',
optimizer=dict(
type='AdamW',
lr=base_lr,
weight_decay=0.05
)
)

# Default setting for scaling LR automatically
# - `enable` means enable scaling LR automatically
Expand Down
1 change: 1 addition & 0 deletions configs/rsprompter/rsprompter_query-whu.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
),
)
optim_wrapper = dict(
__delete__=True,
type='DeepSpeedOptimWrapper',
optimizer=dict(
type='AdamW',
Expand Down

0 comments on commit b51e916

Please sign in to comment.