mirror of
https://github.com/karpathy/nanochat.git
synced 2025-12-06 04:12:13 +00:00
few more reverts
This commit is contained in:
parent
cbd560a83d
commit
3fa974f93c
|
|
@ -20,7 +20,6 @@ class ColoredFormatter(logging.Formatter):
|
||||||
}
|
}
|
||||||
RESET = '\033[0m'
|
RESET = '\033[0m'
|
||||||
BOLD = '\033[1m'
|
BOLD = '\033[1m'
|
||||||
|
|
||||||
def format(self, record):
|
def format(self, record):
|
||||||
# Add color to the level name
|
# Add color to the level name
|
||||||
levelname = record.levelname
|
levelname = record.levelname
|
||||||
|
|
@ -35,7 +34,6 @@ class ColoredFormatter(logging.Formatter):
|
||||||
message = re.sub(r'(Shard \d+)', rf'{self.COLORS["INFO"]}{self.BOLD}\1{self.RESET}', message)
|
message = re.sub(r'(Shard \d+)', rf'{self.COLORS["INFO"]}{self.BOLD}\1{self.RESET}', message)
|
||||||
return message
|
return message
|
||||||
|
|
||||||
|
|
||||||
def setup_default_logging():
|
def setup_default_logging():
|
||||||
handler = logging.StreamHandler()
|
handler = logging.StreamHandler()
|
||||||
handler.setFormatter(ColoredFormatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s'))
|
handler.setFormatter(ColoredFormatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s'))
|
||||||
|
|
@ -58,7 +56,7 @@ def get_base_dir():
|
||||||
os.makedirs(nanochat_dir, exist_ok=True)
|
os.makedirs(nanochat_dir, exist_ok=True)
|
||||||
return nanochat_dir
|
return nanochat_dir
|
||||||
|
|
||||||
def print0(s="", **kwargs):
|
def print0(s="",**kwargs):
|
||||||
ddp_rank = int(os.environ.get('RANK', 0))
|
ddp_rank = int(os.environ.get('RANK', 0))
|
||||||
if ddp_rank == 0:
|
if ddp_rank == 0:
|
||||||
print(s, **kwargs)
|
print(s, **kwargs)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user