From 81145208d1ee778904c5e0ee7dfb25cde52ce913 Mon Sep 17 00:00:00 2001 From: Jiarui Fang Date: Thu, 24 Mar 2022 17:39:50 +0800 Subject: [PATCH] [install] run with out rich (#513) --- colossalai/logging/logging.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/colossalai/logging/logging.py b/colossalai/logging/logging.py index 1f0ea6c1b..5bc2694c6 100644 --- a/colossalai/logging/logging.py +++ b/colossalai/logging/logging.py @@ -5,12 +5,16 @@ import colossalai import logging from pathlib import Path from typing import Union -from rich.logging import RichHandler from colossalai.context.parallel_mode import ParallelMode -_FORMAT = 'colossalai - %(name)s - %(asctime)s %(levelname)s: %(message)s' -logging.basicConfig(level=logging.INFO, format=_FORMAT, handlers=[RichHandler()]) +try: + from rich.logging import RichHandler + _FORMAT = 'colossalai - %(name)s - %(asctime)s %(levelname)s: %(message)s' + logging.basicConfig(level=logging.INFO, format=_FORMAT, handlers=[RichHandler()]) +except ImportError: + _FORMAT = 'colossalai - %(name)s - %(asctime)s %(levelname)s: %(message)s' + logging.basicConfig(level=logging.INFO, format=_FORMAT) class DistributedLogger: