DeepSpeed

Зеркало из https://github.com/microsoft/DeepSpeed
Форк
0
46 строк · 1.3 Кб
1
# Copyright (c) Microsoft Corporation.
2
# SPDX-License-Identifier: Apache-2.0
3

4
# DeepSpeed Team
5

6
from deepspeed.runtime.config_utils import DeepSpeedConfigModel
7

8
#########################################
9
# Timers
10
#########################################
11
# Timers. By default, timers are enabled.
12
# Users can configure in ds_config.json as below example:
13
TIMERS_FORMAT = '''
14
Timers should be enabled as:
15
"timers": {
16
  "throughput": {
17
    "enabled": true,
18
    "synchronized": true
19
  }
20
}
21
'''
22

23
TIMERS = "timers"
24
TIMERS_THROUGHPUT = "throughput"
25

26

27
def get_timers_config(param_dict):
28
    if param_dict and TIMERS in param_dict and TIMERS_THROUGHPUT in param_dict[TIMERS]:
29
        timers_config_dict = param_dict[TIMERS][TIMERS_THROUGHPUT]
30
    else:
31
        timers_config_dict = {}
32
    return DeepSpeedThroughputTimerConfig(**timers_config_dict)
33

34

35
class DeepSpeedThroughputTimerConfig(DeepSpeedConfigModel):
36
    """ Configure throughput timers """
37

38
    enabled: bool = True
39
    """ Turn on/off throughput timers """
40

41
    synchronized: bool = True
42
    """ Whether to synchronize a device when measuring the time.
43
        Synchronizing a device is required to produce the most accurate timer measurements.
44
        However, this comes at the expense of performance degradation. The CPU timer provides
45
        sufficient accuracy in many cases.
46
      """
47

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.