From 0e665d243b38a492781fec126fb8d4c05f22d037 Mon Sep 17 00:00:00 2001 From: leoleojie <88081427+leoleojie@users.noreply.github.com> Date: Thu, 7 Jul 2022 13:51:15 +0800 Subject: [PATCH 1/7] FEA: hash config and rename log --- recbole/utils/logger.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/recbole/utils/logger.py b/recbole/utils/logger.py index a50e8ce77..1edfa2c16 100644 --- a/recbole/utils/logger.py +++ b/recbole/utils/logger.py @@ -17,7 +17,7 @@ import os import colorlog import re - +import hashlib from recbole.utils.utils import get_local_time, ensure_dir from colorama import init @@ -73,7 +73,9 @@ def init_logger(config): ensure_dir(dir_name) model_name = os.path.join(dir_name, config['model']) ensure_dir(model_name) - logfilename = '{}/{}.log'.format(config['model'], get_local_time()) + config_str = ''.join([str(key) for key in config.final_config_dict.values()]) + md5 = hashlib.md5(config_str.encode(encoding='utf-8')).hexdigest()[:6] + logfilename = '{}/{}-{}.log'.format(config['model'], get_local_time(),md5) logfilepath = os.path.join(LOGROOT, logfilename) From 435f68f4e344f8e57637ed4ffe9b6605378640b7 Mon Sep 17 00:00:00 2001 From: leoleojie <88081427+leoleojie@users.noreply.github.com> Date: Sat, 9 Jul 2022 23:17:20 +0800 Subject: [PATCH 2/7] =?UTF-8?q?FIX=EF=BC=9AHyperTuning=20log=20duplicate?= =?UTF-8?q?=20name,=20add=20command?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- recbole/quick_start/quick_start.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/recbole/quick_start/quick_start.py b/recbole/quick_start/quick_start.py index 05ad69129..f6d58c065 100644 --- a/recbole/quick_start/quick_start.py +++ b/recbole/quick_start/quick_start.py @@ -8,7 +8,7 @@ """ import logging from logging import getLogger - +import sys import torch import pickle @@ -34,7 +34,7 @@ def run_recbole(model=None, dataset=None, config_file_list=None, config_dict=Non # logger initialization init_logger(config) logger = getLogger() - + logger.info(sys.argv) logger.info(config) # dataset filtering @@ -85,6 +85,10 @@ def objective_function(config_dict=None, config_file_list=None, saved=True): config = Config(config_dict=config_dict, config_file_list=config_file_list) init_seed(config['seed'], config['reproducibility']) + logger = getLogger() + for hdlr in logger.handlers[:]: # remove all old handlers + logger.removeHandler(hdlr) + init_logger(config) logging.basicConfig(level=logging.ERROR) dataset = create_dataset(config) train_data, valid_data, test_data = data_preparation(config, dataset) From 2e69bf8b72b82f159fdea80066fcd6b92650855c Mon Sep 17 00:00:00 2001 From: Lanling Xu <61613449+Sherry-XLL@users.noreply.github.com> Date: Sat, 9 Jul 2022 23:32:58 +0800 Subject: [PATCH 3/7] Update logger.py --- recbole/utils/logger.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recbole/utils/logger.py b/recbole/utils/logger.py index 1edfa2c16..e20a7c473 100644 --- a/recbole/utils/logger.py +++ b/recbole/utils/logger.py @@ -75,7 +75,7 @@ def init_logger(config): ensure_dir(model_name) config_str = ''.join([str(key) for key in config.final_config_dict.values()]) md5 = hashlib.md5(config_str.encode(encoding='utf-8')).hexdigest()[:6] - logfilename = '{}/{}-{}.log'.format(config['model'], get_local_time(),md5) + logfilename = '{}/{}-{}.log'.format(config['model'], get_local_time(), md5) logfilepath = os.path.join(LOGROOT, logfilename) From 41eec6ecc1b5655150309bed189973ed94e2193f Mon Sep 17 00:00:00 2001 From: leoleojie <88081427+leoleojie@users.noreply.github.com> Date: Sun, 10 Jul 2022 10:56:46 +0800 Subject: [PATCH 4/7] Update quick_start.py --- recbole/quick_start/quick_start.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recbole/quick_start/quick_start.py b/recbole/quick_start/quick_start.py index c13202509..0369455d9 100644 --- a/recbole/quick_start/quick_start.py +++ b/recbole/quick_start/quick_start.py @@ -10,7 +10,7 @@ from logging import getLogger import sys -import torch + import pickle From ebe9ad0454157d91826e838fd42a02dfb80a58ee Mon Sep 17 00:00:00 2001 From: leoleojie <88081427+leoleojie@users.noreply.github.com> Date: Sun, 10 Jul 2022 10:58:09 +0800 Subject: [PATCH 5/7] Update quick_start.py --- recbole/quick_start/quick_start.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recbole/quick_start/quick_start.py b/recbole/quick_start/quick_start.py index 0369455d9..21dab6054 100644 --- a/recbole/quick_start/quick_start.py +++ b/recbole/quick_start/quick_start.py @@ -1,6 +1,6 @@ -# @Time : 2020/10/6 -# @Author : Shanlei Mu -# @Email : slmu@ruc.edu.cn +# @Time : 2020/10/6, 2022/7/10 +# @Author : Shanlei Mu, Junjie Zhang +# @Email : slmu@ruc.edu.cn, zjj001128@163.com """ recbole.quick_start From 58f780d97ccd3475400f5b90370602ec7443192b Mon Sep 17 00:00:00 2001 From: leoleojie <88081427+leoleojie@users.noreply.github.com> Date: Sun, 10 Jul 2022 11:00:13 +0800 Subject: [PATCH 6/7] Update quick_start.py --- recbole/quick_start/quick_start.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/recbole/quick_start/quick_start.py b/recbole/quick_start/quick_start.py index 21dab6054..0aac9a56b 100644 --- a/recbole/quick_start/quick_start.py +++ b/recbole/quick_start/quick_start.py @@ -1,6 +1,11 @@ -# @Time : 2020/10/6, 2022/7/10 -# @Author : Shanlei Mu, Junjie Zhang -# @Email : slmu@ruc.edu.cn, zjj001128@163.com +# @Time : 2020/10/6 +# @Author : Shanlei Mu +# @Email : slmu@ruc.edu.cn + +# UPDATE: +# @Time : 2022/07/10 +# @Author : Junjie Zhang +# @Email : zjj001128@163.com """ recbole.quick_start From 8cf079ee16b7d5045b4eefb42df316193eda7e0e Mon Sep 17 00:00:00 2001 From: leoleojie <88081427+leoleojie@users.noreply.github.com> Date: Sun, 10 Jul 2022 11:00:57 +0800 Subject: [PATCH 7/7] Update logger.py --- recbole/utils/logger.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/recbole/utils/logger.py b/recbole/utils/logger.py index e20a7c473..18b850e9c 100644 --- a/recbole/utils/logger.py +++ b/recbole/utils/logger.py @@ -8,6 +8,11 @@ # @Author : Jiawei Guan # @Email : guanjw@ruc.edu.cn +# UPDATE: +# @Time : 2022/07/10 +# @Author : Junjie Zhang +# @Email : zjj001128@163.com + """ recbole.utils.logger ###############################