2023-12-21 09:25:22 -07:00
|
|
|
from functools import lru_cache
|
2024-07-20 11:02:04 -06:00
|
|
|
from text_generation_server.utils.dist import RANK
|
2023-12-21 09:25:22 -07:00
|
|
|
|
|
|
|
|
|
|
|
@lru_cache(10)
|
2024-07-20 11:02:04 -06:00
|
|
|
def log_once(log, msg: str, master=True):
|
|
|
|
if master:
|
|
|
|
log_master(log, msg)
|
|
|
|
else:
|
|
|
|
log(msg)
|
|
|
|
|
|
|
|
|
|
|
|
def log_master(log, msg: str):
|
|
|
|
if RANK == 0:
|
|
|
|
log(msg)
|