-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AutoTuner] support prune by memory cost model
- Loading branch information
1 parent
b960cec
commit 6cd6ac2
Showing
2 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from argparse import ArgumentParser | ||
|
||
def parse_arguments(): | ||
parser = ArgumentParser() | ||
|
||
# for distributed strategy | ||
parser.add_argument("dp_degree", type=int, help="dp degree") | ||
parser.add_argument("pp_degree", type=int, help="pp degree") | ||
parser.add_argument("mp_degree", type=int, help="mp degree") | ||
parser.add_argument("sharding_degree", type=int, help="sharding degree") | ||
parser.add_argument("sharding_stage", type=int, help="sharding stage") | ||
parser.add_argument("micro_batch_size", type=int, help="micro batch size") | ||
parser.add_argument("use_recompute", type=bool, help="use recompute") | ||
parser.add_argument("recompute_granularity", type=int, help="recompute granularity") | ||
|
||
# for model config | ||
parser.add_argument("hidden_size", type=int, help="hidden size") | ||
parser.add_argument("num_attention_heads", type=int, help="number of attention heads") | ||
parser.add_argument("num_hidden_layers", type=int, help="number of hidden layers") | ||
parser.add_argument("max_sequence_length", type=int, help="maximum sequence length") | ||
parser.add_argument("vocab_size", type=int, help="vocabulary size") | ||
parser.add_argument("intermediate_size", type=int, help="intermediate size") | ||
|
||
return parser.parse_args() | ||
|
||
def get_model_memory_usage(args): | ||
# evaluate model memory usage based on distributed strategy and model setting | ||
raise NotImplementedError("Please implement this function for memory usage estimation based on distributed strategy and model setting.") | ||
|
||
if __name__ == "__main__": | ||
args = parse_arguments() | ||
print(get_model_memory_usage(args)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters