MCPcopy Create free account
hub / github.com/deepspeedai/DeepSpeed / warning_once

Function warning_once

deepspeed/utils/logging.py:65–73  ·  view source on GitHub ↗

This method is identical to `logger.warning()`, but will emit the warning with the same message only once Note: The cache is for the function arguments, so 2 different callers using the same arguments will hit the cache. The assumption here is that all warning messages are unique acros

(*args, **kwargs)

Source from the content-addressed store, hash-verified

63
64@functools.lru_cache(None)
65def warning_once(*args, **kwargs):
66 """
67 This method is identical to `logger.warning()`, but will emit the warning with the same message only once
68
69 Note: The cache is for the function arguments, so 2 different callers using the same arguments will hit the cache.
70 The assumption here is that all warning messages are unique across the code. If they aren't then need to switch to
71 another type of cache that includes the caller frame information in the hashing function.
72 """
73 logger.warning(*args, **kwargs)
74
75
76logger.warning_once = warning_once

Callers 3

find_matching_specMethod · 0.90
prepare_tp_fused_qkvwFunction · 0.90
__init__Method · 0.90

Calls 1

warningMethod · 0.80

Tested by

no test coverage detected