-
-
Notifications
You must be signed in to change notification settings - Fork 476
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FEAT: [BEAUTIFY in GPT4Vision][Disable logging in __init__ of swarms]
- Loading branch information
Kye
committed
Nov 25, 2023
1 parent
51c82cf
commit f895497
Showing
4 changed files
with
58 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
import logging | ||
import os | ||
import warnings | ||
|
||
def disable_logging(): | ||
warnings.filterwarnings("ignore", category=UserWarning) | ||
|
||
# disable tensorflow warnings | ||
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3" | ||
|
||
|
||
# Set the logging level for the entire module | ||
logging.basicConfig(level=logging.WARNING) | ||
|
||
try: | ||
log = logging.getLogger("pytorch") | ||
log.propagate = False | ||
log.setLevel(logging.ERROR) | ||
except Exception as error: | ||
print(f"Pytorch logging not disabled: {error}") | ||
|
||
for logger_name in ['tensorflow', 'h5py', 'numexpr', 'git', 'wandb.docker.auth']: | ||
logger = logging.getLogger(logger_name) | ||
logger.setLevel(logging.WARNING) # Supress DEBUG and info logs |