Skip to content

Commit

Permalink
【AutoParallelism】add "refined_ops_patterns" in recompute strategy (#7349
Browse files Browse the repository at this point in the history
)

* add refined_ops_patterns in recompute strategy

* modify the yaml file

* add sr

* fix yaml file"
  • Loading branch information
heavyrain-lzy authored Nov 2, 2023
1 parent fc2bf9c commit c013ccb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ Model:
fuse_attn_qkv: True
use_recompute: True
recompute_granularity:
sr: 0
refined_ops_patterns:
- {main_ops: [matmul_v2, elementwise_add], num: 0, pre_ops: [], suf_ops: []}
- {main_ops: [flash_attn], num: 0, pre_ops: [], suf_ops: []}
no_recompute_layers:


Expand Down
2 changes: 2 additions & 0 deletions model_zoo/gpt-3/ppfleetx/utils/auto_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ def process_strategy(config):
config.Model["no_recompute_layers"] = sorted(list(set(config.Model["no_recompute_layers"])))
recompute = strategy.recompute
recompute.enable = config.Model.get("use_recompute", False)
recompute.sr = config.Model.pop("sr", 0)
recompute.refined_ops_patterns = config.Model.pop("refined_ops_patterns", []) # gpt.GPTModelAuto don't need this parameter
recompute.no_recompute_segments = config.Model.pop("no_recompute_layers", [])
recompute.enable_tuning = config.get("Tuning", False) and config.Tuning.get("tuning_recompute", False)

Expand Down

0 comments on commit c013ccb

Please sign in to comment.