MCPcopy Create free account
hub / github.com/AIS-SNU/Smart-Infinity / warning_once

Function warning_once

deepspeed/utils/logging.py:54–62  ·  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

52
53@functools.lru_cache(None)
54def warning_once(*args, **kwargs):
55 """
56 This method is identical to `logger.warning()`, but will emit the warning with the same message only once
57
58 Note: The cache is for the function arguments, so 2 different callers using the same arguments will hit the cache.
59 The assumption here is that all warning messages are unique across the code. If they aren't then need to switch to
60 another type of cache that includes the caller frame information in the hashing function.
61 """
62 logger.warning(*args, **kwargs)
63
64
65logger.warning_once = warning_once

Callers

nothing calls this directly

Calls 1

warningMethod · 0.80

Tested by

no test coverage detected