示例#1
0
def output_results(results_dict, tablefmt="github"):
    variant = list(results_dict.keys())[0]
    col_names = ["Variant"] + list(results_dict[variant][-1].keys())
    tab_data = tabulate_results(results_dict)

    print(tabulate(tab_data, headers=col_names, tablefmt=tablefmt))
示例#2
0
文件: train.py 项目: lizr16/cogdl-1
    for item in variants:
        if (item.model, item.dataset) not in pairs:
            print(
                f"({item.model}, {item.dataset}) is not implemented in task '{task}''."
            )
            continue
        clean_variants.append(item)
    if not clean_variants:
        exit(0)
    return clean_variants


if __name__ == "__main__":
    parser = options.get_training_parser()
    args, _ = parser.parse_known_args()
    args = options.parse_args_and_arch(parser, args)
    print(args)
    assert len(args.device_id) == 1
    variants = list(
        gen_variants(dataset=args.dataset, model=args.model, seed=args.seed))
    variants = check_task_dataset_model_match(args.task, variants)
    # Collect results
    results_dict = defaultdict(list)
    results = [main(args) for args in variant_args_generator(args, variants)]
    for variant, result in zip(variants, results):
        results_dict[variant[:-1]].append(result)

    col_names = ["Variant"] + list(results_dict[variant[:-1]][-1].keys())
    tab_data = tabulate_results(results_dict)
    print(tabulate(tab_data, headers=col_names, tablefmt="github"))