Skip to content

Commit edd97f9

Browse files
authored
[hybrid fix] fix sharding save offload (#40477)
1 parent 930a513 commit edd97f9

File tree

1 file changed

+4
-3
lines changed
  • python/paddle/distributed/fleet/meta_optimizers/sharding

1 file changed

+4
-3
lines changed

python/paddle/distributed/fleet/meta_optimizers/sharding/utils.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -900,11 +900,12 @@ def save_persistables(exe, dirname, main_program, filename=None):
900900

901901
def is_opt_vars(var):
902902
# NOTE(JZ-LIANG): The checks should be updated when add new compatible optimizer
903-
# now only Momentum and adam are compatible with sharding
904-
# support EMA optimizer
903+
# now only Momentum and adam are compatible with sharding,
904+
# support EMA optimizer with '_ema_0',
905+
# support offload with '@offload_0' and '.cast_fp16'
905906
checks = [
906907
"_moment1_0", "_moment2_0", "_beta1_pow_acc_0", "_beta2_pow_acc_0",
907-
"_velocity_0", "_ema_0"
908+
"_velocity_0", "_ema_0", "@offload_0", ".cast_fp16"
908909
]
909910
for check in checks:
910911
if var.name.endswith(check) and var.persistable:

0 commit comments

Comments
 (0)