-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathds_utils.py
50 lines (46 loc) · 1.41 KB
/
ds_utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0
# DeepSpeed Team
def get_train_ds_config(offload,
stage=2,
enable_hybrid_engine=False,
inference_tp_size=1,
release_inference_cache=False,
pin_parameters=True,
tp_gather_partition_size=8,
max_out_tokens=512):
device = "cpu" if offload else "none"
zero_opt_dict = {
"stage": stage,
"overlap_comm": False,
"reduce_bucket_size": "auto",
"contiguous_gradients": True,
}
return {
"train_batch_size": "auto",
"train_micro_batch_size_per_gpu": "auto",
"zero_optimization": zero_opt_dict,
"bf16":{
"enabled" : "auto"
},
"postscale_gradients": True,
"gradient_clipping": "auto",
"gradient_accumulation_steps": "auto",
"scheduler": {
"type": "WarmupCosineLR",
"params": {
"warmup_min_ratio": 0,
"warmup_num_steps": "auto",
"total_num_steps": "auto"
}
},
"optimizer": {
"type": "AdamW",
"params": {
"lr": "auto",
"betas": "auto",
"eps": 1e-8,
"weight_decay": "auto"
}
},
}