コード例 #1
0
def save_example():
    # configurations initialization
    config_dict = {
        'checkpoint_dir': '../saved',
        'save_dataset': True,
        'save_dataloaders': True,
    }
    run_recbole(model='BPR', dataset='ml-100k', config_dict=config_dict)
コード例 #2
0
def run_parms(parm_dict, extra_dict=None):
    config_dict = {'epochs': 1, 'state': 'INFO'}
    for name, parms in parm_dict.items():
        for parm in parms:
            config_dict[name] = parm
            if extra_dict is not None:
                config_dict.update(extra_dict)
            try:
                run_recbole(model='BPR',
                            dataset='ml-100k',
                            config_dict=config_dict)
            except Exception as e:
                logging.critical(f'\ntest `{name}`={parm} ... fail.\n')
                return False
    return True
コード例 #3
0
def run_test_examples():

    test_start_time = time()
    success_examples, fail_examples = [], []
    n_examples = len(test_examples.keys())
    for idx, example in enumerate(test_examples.keys()):
        if example in closed_examples:
            continue
        print('\n\n Begin to run %d / %d example: %s \n\n' % (idx + 1, n_examples, example))
        try:
            config_dict = test_examples[example]
            if 'epochs' not in config_dict:
                config_dict['epochs'] = 1
            run_recbole(config_dict=config_dict, saved=False)
            print('\n\n Running %d / %d example successfully: %s \n\n' % (idx + 1, n_examples, example))
            success_examples.append(example)
        except Exception:
            print(traceback.format_exc())
            fail_examples.append(example)
    test_end_time = time()
    print('total test time: ', test_end_time - test_start_time)
    print('success examples: ', success_examples)
    print('fail examples: ', fail_examples)
    print('\n')
コード例 #4
0
from recbole.quick_start import run_recbole

run_recbole()
コード例 #5
0
ファイル: run_recbole.py プロジェクト: xingkongxiaxia/xx
# @Email  : [email protected], [email protected]

import argparse

from recbole.quick_start import run_recbole

if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument('--model',
                        '-m',
                        type=str,
                        default='BPR',
                        help='name of models')
    parser.add_argument('--dataset',
                        '-d',
                        type=str,
                        default='ml-100k',
                        help='name of datasets')
    parser.add_argument('--config_files',
                        type=str,
                        default=None,
                        help='config files')

    args, _ = parser.parse_known_args()

    config_file_list = args.config_files.strip().split(
        ' ') if args.config_files else None
    run_recbole(model=args.model,
                dataset=args.dataset,
                config_file_list=config_file_list)