From f45dfe8ba78cd04bf97e1187a617e94ad8f7501e Mon Sep 17 00:00:00 2001 From: yin Date: Wed, 15 Dec 2021 16:01:36 +0800 Subject: [PATCH 1/3] dataloader note --- recbole/data/dataloader/general_dataloader.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recbole/data/dataloader/general_dataloader.py b/recbole/data/dataloader/general_dataloader.py index aaefdb6e5..b909201c8 100644 --- a/recbole/data/dataloader/general_dataloader.py +++ b/recbole/data/dataloader/general_dataloader.py @@ -39,9 +39,9 @@ def __init__(self, config, dataset, sampler, shuffle=False): def _init_batch_size_and_step(self): batch_size = self.config['train_batch_size'] - if self.neg_sample_args['strategy'] == 'by': - batch_num = max(batch_size // self.times, 1) - new_batch_size = batch_num * self.times + if self.neg_sample_args['strategy'] == 'by': # self.times = 1 + neg_sample_num + batch_num = max(batch_size // self.times, 1) # batch size 整除 采样次数 + 1,最少一个 正例 + new_batch_size = batch_num * self.times # 最后 batch 有几个为 self.step = batch_num self.set_batch_size(new_batch_size) else: From 5bd9f82430ae1b51162db4888c24012b20541e43 Mon Sep 17 00:00:00 2001 From: yin Date: Tue, 4 Jan 2022 20:20:37 +0800 Subject: [PATCH 2/3] using model name category experiments log --- recbole/utils/logger.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/recbole/utils/logger.py b/recbole/utils/logger.py index d5d5d52ca..a50e8ce77 100644 --- a/recbole/utils/logger.py +++ b/recbole/utils/logger.py @@ -71,8 +71,9 @@ def init_logger(config): LOGROOT = './log/' dir_name = os.path.dirname(LOGROOT) ensure_dir(dir_name) - - logfilename = '{}-{}.log'.format(config['model'], get_local_time()) + model_name = os.path.join(dir_name, config['model']) + ensure_dir(model_name) + logfilename = '{}/{}.log'.format(config['model'], get_local_time()) logfilepath = os.path.join(LOGROOT, logfilename) From a5332450fd2adc9a310218911b2ced3981dba46d Mon Sep 17 00:00:00 2001 From: chenyushuo <297086016@qq.com> Date: Thu, 6 Jan 2022 10:44:40 +0800 Subject: [PATCH 3/3] Update recbole/data/dataloader/general_dataloader.py --- recbole/data/dataloader/general_dataloader.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recbole/data/dataloader/general_dataloader.py b/recbole/data/dataloader/general_dataloader.py index b909201c8..aaefdb6e5 100644 --- a/recbole/data/dataloader/general_dataloader.py +++ b/recbole/data/dataloader/general_dataloader.py @@ -39,9 +39,9 @@ def __init__(self, config, dataset, sampler, shuffle=False): def _init_batch_size_and_step(self): batch_size = self.config['train_batch_size'] - if self.neg_sample_args['strategy'] == 'by': # self.times = 1 + neg_sample_num - batch_num = max(batch_size // self.times, 1) # batch size 整除 采样次数 + 1,最少一个 正例 - new_batch_size = batch_num * self.times # 最后 batch 有几个为 + if self.neg_sample_args['strategy'] == 'by': + batch_num = max(batch_size // self.times, 1) + new_batch_size = batch_num * self.times self.step = batch_num self.set_batch_size(new_batch_size) else: