How to use get_log_path method in tox

Best Python code snippet using tox_python

visualize_scores.py

Source:visualize_scores.py Github

copy

Full Screen

1# %%2import pandas as pd3import numpy as np4import sys5datasets = [6"winogrande-winogrande_xl",7"super_glue-cb",8"super_glue-rte",9"anli_r1",10"anli_r2",11"anli_r3", # "anli",12"story_cloze-2016",13"super_glue-wsc.fixed",14# "super_glue-copa",15"hellaswag",16"super_glue-wic",17]18all_datasets = [19 # "ai2_arc-ARC-Easy",20 # "race-high",21 "piqa",22 "ai2_arc-ARC-Challenge",23 "squad_v2",24 "openbookqa-main",25 # "race-middle",26 # "super_glue-multirc",27 # "super_glue-boolq",28 "super_glue-wic",29 # "super_glue-copa",30 "super_glue-wsc.fixed",31 "winogrande-winogrande_xl",32 "super_glue-cb",33 # "super_glue-rte",34 # "anli_r1",35 # "anli_r2",36 "anli_r3",37 # "story_cloze-2016",38 "hellaswag",39]40bigbench_tasks = [41 # "code_line_description",42 "hindu_knowledge",43 "known_unknowns",44 "logic_grid_puzzle",45 # "misconceptions",46 "movie_dialog_same_or_different",47 # "novel_concepts",48 "strategyqa",49 # "formal_fallacies_syllogisms_negation",50 "vitaminc_fact_verification",51 # "winowhy",52]53csr_downstream_tasks = [54 "squad_v2",55 "super_glue-boolq",56 "super_glue-wic",57 "super_glue-cb",58 "super_glue-rte",59 # "anli_r1",60 # "anli_r2",61 # "anli_r3",62 "glue-mrpc",63 "glue-qqp",64 "rotten_tomatoes",65 "imdb",66 "ag_news"67]68# all_datasets = csr_downstream_tasks69# all_datasets = bigbench_tasks70# %%71def time_judge(line, threshold_time="2022-01-11 00:27:18"):72 if '[2022' in line:73 time_start = line.index("[") +174 time_end = line.index("]")75 time_str = line[time_start:time_end]76 from dateutil import parser77 time_ = parser.parse(time_str)78 threshold = parser.parse(threshold_time)79 if time_ < threshold:80 return False81 return True82def get_result(get_log_path_fn, prefix, time_threashold=None, use_soft_score=False):83 results = []84 for dataset in all_datasets:85 # for dataset in datasets:86 logf = get_log_path_fn(prefix, dataset)87 # print(logf)88 try:89 with open(logf) as f:90 lines = f.read().splitlines()91 except Exception as e:92 print(e)93 continue94 seen_column_strs = set()95 for line in lines[::-1]:96 # time = [2022-01-11 17:27:18][INFO ]97 perf_str = "test_perf"98 if "Evaluate" in line and "{'EM':" in line and dataset in line and "round" not in line:99 if time_threashold and not time_judge(line, time_threashold):100 continue101 # print(line)102 task_ind_start = line.index("Evaluate ") + len("Evaluate ")103 task_ind_end = line.index(" : {'EM':")104 score_ind_start = line.index("{'EM': ") + len("{'EM': ")105 score_ind_end = line.index(",")106 task_name = line[task_ind_start:task_ind_end].strip()107 assert task_name == dataset108 soft_score_ind_start = line.index("'SoftEM': ") + len("'SoftEM': ")109 soft_score_ind_end = line.index("}")110 score = line[score_ind_start:score_ind_end].strip()111 score = float(score)112 soft_score = line[soft_score_ind_start:soft_score_ind_end].strip()113 soft_score = float(soft_score)114 res = {}115 res["task"] = task_name116 # res["score"] = score117 # res["prefix"] = prefix118 if use_soft_score:119 res[f"{prefix}"] = soft_score120 else:121 res[f"{prefix}"] = score122 if prefix in seen_column_strs:123 continue124 results.append(res)125 seen_column_strs.add(prefix)126 elif perf_str in line and "EM-->" in line and dataset in line:127 if time_threashold and not time_judge(line, time_threashold):128 continue129 # [2022-01-24 14:37:00][INFO ] test_perf: ai2_arc-ARC-Easy round #9 with EM--> {'EM': 0.46, 'SoftEM': 0.589}130 res = {}131 task_ind_start = line.index(perf_str+": ") + len(perf_str+": ")132 # task_ind_start = line.index("test_perf: ") + len("test_perf: ")133 task_ind_end = line.index("round")134 round_ind_start = line.index("round #") + len("round #")135 round_ind_end = line.index(" with EM")136 score_ind_start = line.index("{'EM': ") + len("{'EM': ")137 score_ind_end = line.index(",")138 soft_score_ind_start = line.index("'SoftEM': ") + len("'SoftEM': ")139 soft_score_ind_end = line.index("}")140 task_name = line[task_ind_start:task_ind_end].strip()141 assert task_name == dataset142 round_id = line[round_ind_start:round_ind_end].strip()143 score = line[score_ind_start:score_ind_end].strip()144 score = float(score)145 soft_score = line[soft_score_ind_start:soft_score_ind_end].strip()146 soft_score = float(soft_score)147 res["task"] = task_name148 column_str = f"{'-'.join([str(p) for p in prefix])}@{round_id}"149 column_str = column_str.replace("SentenceTransformer", "SBERT")150 column_str = column_str.replace("two-stage", "2s")151 column_str = column_str.replace("unsupervised", "0s")152 if use_soft_score:153 res[column_str] = soft_score154 else:155 res[column_str] = score156 if column_str in seen_column_strs:157 continue158 results.append(res)159 seen_column_strs.add(column_str)160 return results161# res["average"] = np.mean(list(res.values()))162# print(res)163def process_exp(get_log_path_fn, prefixes, time_threashold=None, use_soft_score=False):164 results = []165 for prefix in prefixes:166 result = get_result(get_log_path_fn, prefix=prefix, time_threashold=time_threashold, use_soft_score=use_soft_score)167 # res["seed"] = str(seed)168 # print(f"{prefix} = {results}")169 results += result170 return results171def clear_and_print(all_results):172 all_results_pd = pd.DataFrame(all_results).sort_values(by=['task']).drop_duplicates().groupby("task").sum().reset_index()173 pd.options.display.float_format = '{:.2%}'.format174 # print(all_results_pd)175 print(all_results_pd.to_csv(index=False))176use_soft_score = True177print(f"use_soft_score={use_soft_score}")178all_results = []179# For Zeroshot Evalution180get_log_path = lambda model_name, task_name: f"logs/{model_name}-zeroshot/{model_name}-zs-{task_name}.log"181all_results += process_exp(get_log_path, ["BART0", "T0_3B"], time_threashold="2022-01-25 00:27:18", use_soft_score=use_soft_score) # , "T0_3B"182clear_and_print(all_results)183all_results = []184 185# ----------- # get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_Random/RET_Random-unsupervised_rerank-2-32-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 186# ----------- # all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-02-25 12:20:18", use_soft_score=use_soft_score)187# ----------- # clear_and_print(all_results)188# ----------- # all_results = []189# ----------- # get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_Random/RET_Random-unsupervised_rerank(mean)-5-32-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 190# ----------- # all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-02-25 12:20:18", use_soft_score=use_soft_score)191# ----------- # clear_and_print(all_results)192# ----------- # all_results = []193# ----------- # get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_Random/RET_Random-unsupervised_rerank-10-32-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 194# ----------- # all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-02-25 12:20:18", use_soft_score=use_soft_score)195# ----------- # clear_and_print(all_results)196# ----------- # all_results = []197## Finalized results 198# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_Random/RET_Random-unsupervised_no-1-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 199# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-03-05 12:20:18", use_soft_score=use_soft_score)200# clear_and_print(all_results)201# all_results = []202# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_SentenceTransformer/RET_SentenceTransformer-unsupervised_no-1-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 203# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-03-05 12:00:00", use_soft_score=use_soft_score)204# clear_and_print(all_results)205# all_results = []206# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_no-1-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 207# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-03-05 12:00:18", use_soft_score=use_soft_score)208# clear_and_print(all_results)209# all_results = []210# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_Random/RET_Random-unsupervised_rerank-2-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 211# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-03-05 12:00:18", use_soft_score=use_soft_score)212# clear_and_print(all_results)213# all_results = []214# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_SentenceTransformer/RET_SentenceTransformer-unsupervised_rerank-2-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 215# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-03-05 12:00:18", use_soft_score=use_soft_score)216# clear_and_print(all_results)217# all_results = []218# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_rerank-2-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 219# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-03-05 23:00:18", use_soft_score=use_soft_score)220# clear_and_print(all_results)221# all_results = []222# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_rerank-2-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 223# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-04-01 23:00:18", use_soft_score=use_soft_score)224# clear_and_print(all_results)225# all_results = []226#------------------------#227# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_Random/RET_Random-unsupervised_rerank_roberta_base-2-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 228# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-04-01 23:00:18", use_soft_score=use_soft_score)229# clear_and_print(all_results)230# all_results = []231# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_SentenceTransformer/RET_SentenceTransformer-unsupervised_rerank_roberta_base-2-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 232# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-04-01 23:00:18", use_soft_score=use_soft_score)233# clear_and_print(all_results)234# all_results = []235# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_rerank-2-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 236# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-04-01 23:00:18", use_soft_score=use_soft_score)237# clear_and_print(all_results)238# all_results = []239# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_rerank_roberta_baseI2-2-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 240# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-04-01 23:00:18", use_soft_score=use_soft_score)241# clear_and_print(all_results)242# all_results = []243# ========================================== Abalation 244# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_rerank_roberta_base-2-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 245# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-04-01 23:00:18", use_soft_score=use_soft_score)246# clear_and_print(all_results)247all_results = []248# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_rerank_roberta_base-2-32-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 249# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-04-08 23:00:18", use_soft_score=use_soft_score)250# clear_and_print(all_results)251# all_results = []252# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_rerank_roberta_base-2-64-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 253# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-04-08 23:00:18", use_soft_score=use_soft_score)254# clear_and_print(all_results)255# all_results = []256# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_rerank_roberta_base-2-16-256-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 257# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-04-08 23:00:18", use_soft_score=use_soft_score)258# clear_and_print(all_results)259# all_results = []260# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_rerank_roberta_base-2-16-1024-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 261# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-04-08 23:00:18", use_soft_score=use_soft_score)262# clear_and_print(all_results)263# all_results = []264# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_rerank_roberta_base-2-1-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 265# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-04-01 23:00:18", use_soft_score=use_soft_score)266# clear_and_print(all_results)267# all_results = []268# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_rerank_roberta_base-2-8-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 269# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-04-01 23:00:18", use_soft_score=use_soft_score)270# clear_and_print(all_results)271# all_results = []272# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_rerank_roberta_base-2-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 273# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-04-01 23:00:18", use_soft_score=use_soft_score)274# clear_and_print(all_results)275# all_results = []276# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_rerank_roberta_base-2-32-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 277# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-04-01 23:00:18", use_soft_score=use_soft_score)278# clear_and_print(all_results)279# all_results = []280get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_rerank_roberta_base-1.5-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 281all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-04-01 23:00:18", use_soft_score=use_soft_score)282clear_and_print(all_results)283all_results = []284get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_rerank_roberta_base-2-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 285all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-04-15 00:00:18", use_soft_score=use_soft_score)286clear_and_print(all_results)287all_results = []288get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_rerank_roberta_base-3-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 289all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-04-01 23:00:18", use_soft_score=use_soft_score)290clear_and_print(all_results)291all_results = []292get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_rerank_roberta_base-4-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 293all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-04-01 23:00:18", use_soft_score=use_soft_score)294clear_and_print(all_results)295all_results = []296# not good297# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_rerank_bart0-2-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 298# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-04-01 23:00:18", use_soft_score=use_soft_score)299# clear_and_print(all_results)300# all_results = []301# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_rerank_roberta_baseI1-2-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 302# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-04-01 23:00:18", use_soft_score=use_soft_score)303# clear_and_print(all_results)304# all_results = []305# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_rerank_roberta_baseI01m-2-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 306# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-04-01 23:00:18", use_soft_score=use_soft_score)307# clear_and_print(all_results)308# all_results = []309# big bench 310# print("BART0+Rerank")311# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_rerank_roberta_base-2-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 312# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-04-12 23:00:18", use_soft_score=use_soft_score)313# clear_and_print(all_results)314# all_results = []315# print("BART0")316# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_no_none-1-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 317# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-04-12 23:00:18", use_soft_score=use_soft_score)318# clear_and_print(all_results)319# all_results = []320# print("SBERT")321# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_SentenceTransformer/RET_SentenceTransformer-unsupervised_no_none-1-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 322# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-04-12 23:00:18", use_soft_score=use_soft_score)323# clear_and_print(all_results)324# all_results = []325# print("Random")326# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_Random/RET_Random-unsupervised_no_none-1-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 327# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-04-12 23:00:18", use_soft_score=use_soft_score)328# clear_and_print(all_results)329# all_results = []330 331# removal abalation 332# remove = "none"333# groupnames = [334# "none",335# "multiple_choice_qa",336# "summarization",337# "extractive_qa",338# "sentiment",339# "closed_book_qa",340# "structure_to_text",341# "topic_classification",342# "paraphrase_identification",343# ]344# for remove in groupnames:345# print(f"----{remove}-----")346# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_rerank_roberta_base-{remove}-2-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 347# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-04-01 23:00:18", use_soft_score=use_soft_score)348# clear_and_print(all_results)349# all_results = []350# =======================================351# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_rerank_roberta_base-3-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 352# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-04-01 23:00:18", use_soft_score=use_soft_score)353# clear_and_print(all_results)354# all_results = []355# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_rerank_bart0_base-2-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 356# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-04-01 23:00:18", use_soft_score=use_soft_score)357# clear_and_print(all_results)358# all_results = []359exit()360# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_rerank-2-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 361# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-03-06 00:00:18", use_soft_score=use_soft_score)362# clear_and_print(all_results)363# all_results = []364# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_SentenceTransformer/RET_SentenceTransformer-unsupervised_rerank-3-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 365# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-03-02 12:00:18", use_soft_score=use_soft_score)366# clear_and_print(all_results)367# all_results = []368# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_TwoStage-BART-TRAINED/RET_TwoStage-BART-TRAINED-unsupervised_no-2-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 369# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-03-02 12:00:18", use_soft_score=use_soft_score)370# clear_and_print(all_results)371# all_results = []372exit()373# -----------------------------------374print("-"*100)375get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_Random/RET_Random-unsupervised_no-1-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 376all_results += process_exp(get_log_path, [(x, "6e-6") for x in "2022".split(",") ], time_threashold="2022-03-02 12:00:18", use_soft_score=use_soft_score)377clear_and_print(all_results)378all_results = []379 380get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_SentenceTransformer/RET_SentenceTransformer-unsupervised_no-1-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 381all_results += process_exp(get_log_path, [(x, "6e-6") for x in "2022".split(",") ], time_threashold="2022-03-02 12:00:18", use_soft_score=use_soft_score)382clear_and_print(all_results)383all_results = []384get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_no-1-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 385all_results += process_exp(get_log_path, [(x, "6e-6") for x in "2022".split(",") ], time_threashold="2022-03-03 12:00:18", use_soft_score=use_soft_score)386clear_and_print(all_results)387all_results = []388 389# print("*"*50)390# # get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_Random/RET_Random-unsupervised_rerank-3-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 391# # all_results += process_exp(get_log_path, [(x, "6e-6") for x in "2022".split(",") ], time_threashold="2022-03-02 12:00:18", use_soft_score=use_soft_score)392# # clear_and_print(all_results)393# # all_results = []394 395# # get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_SentenceTransformer/RET_SentenceTransformer-unsupervised_rerank-3-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 396# # all_results += process_exp(get_log_path, [(x, "6e-6") for x in "2022".split(",") ], time_threashold="2022-03-02 12:00:18", use_soft_score=use_soft_score)397# # clear_and_print(all_results)398# # all_results = []399# # get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_rerank-3-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 400# # all_results += process_exp(get_log_path, [(x, "6e-6") for x in "2022".split(",") ], time_threashold="2022-03-02 12:00:18", use_soft_score=use_soft_score)401# # clear_and_print(all_results)402# # all_results = []403# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_vBART/RET_vBART-unsupervised_no-1-16-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 404# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "2022".split(",") ], time_threashold="2022-03-02 12:00:18", use_soft_score=use_soft_score)405# clear_and_print(all_results)406# all_results = []407# -------------------------------------408# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_no-1-16-512-{prefix[0]}_scores-{task_name}-{prefix[1]}-2.log" 409# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-03-01 12:00:18", use_soft_score=use_soft_score)410# clear_and_print(all_results)411# all_results = []412# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_no-1-32-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 413# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-03-01 12:00:18", use_soft_score=use_soft_score)414# clear_and_print(all_results)415# all_results = []416# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_SentenceTransformer/RET_SentenceTransformer-unsupervised_rerank-5-32-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 417# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-03-01 12:00:00", use_soft_score=use_soft_score)418# clear_and_print(all_results)419# all_results = []420# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_rerank-3-32-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 421# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-03-01 12:00:18", use_soft_score=use_soft_score)422# clear_and_print(all_results)423# all_results = []424# -------------------------------425# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_TRAINED/RET_TRAINED-unsupervised_rerank-5-32-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 426# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-02-25 12:20:18", use_soft_score=use_soft_score)427# clear_and_print(all_results)428# all_results = []429# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_SentenceTransformer/RET_SentenceTransformer-unsupervised_rerank-5-32-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 430# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-02-25 12:20:18", use_soft_score=use_soft_score)431# clear_and_print(all_results)432# all_results = []433# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_rerank-5-32-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 434# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-02-25 12:20:18", use_soft_score=use_soft_score)435# clear_and_print(all_results)436# all_results = []437# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_no-1-32-1024-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 438# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-02-25 12:20:18", use_soft_score=use_soft_score)439# clear_and_print(all_results)440# all_results = []441# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_no-1-64-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 442# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-02-28 12:20:18", use_soft_score=use_soft_score)443# clear_and_print(all_results)444# all_results = []445# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_BART/RET_BART-unsupervised_rerank-10-32-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 446# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-02-25 12:20:18", use_soft_score=use_soft_score)447# clear_and_print(all_results)448# all_results = []449# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_TRAINED/RET_TRAINED-unsupervised_no-1-32-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 450# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-02-25 12:20:18", use_soft_score=use_soft_score)451# clear_and_print(all_results)452# all_results = []453# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_Random/RET_Random-unsupervised_rerank(max)-5-32-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 454# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-02-25 12:20:18", use_soft_score=use_soft_score)455# clear_and_print(all_results)456# all_results = []457# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_Random/RET_Random-unsupervised_rerank(sm)-3-32-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 458# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-02-25 12:20:18", use_soft_score=use_soft_score)459# clear_and_print(all_results)460# all_results = []461# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_Random/RET_Random-unsupervised_rerank-10-32-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 462# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-02-22 20:20:18", use_soft_score=use_soft_score)463# clear_and_print(all_results)464# all_results = []465# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_SentenceTransformer/RET_SentenceTransformer-unsupervised_rerank-5-32-512-{prefix[0]}-{task_name}-{prefix[1]}-2.log" 466# all_results += process_exp(get_log_path, [(x, "6e-6") for x in "42".split(",") ], time_threashold="2022-02-21 10:20:18", use_soft_score=use_soft_score)467# clear_and_print(all_results)468# all_results = []469# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_Random/RET_Random-unsupervised_rerank-64-512-{prefix[0]}-all-{prefix[1]}-1.log" 470# all_results += process_exp(get_log_path, [(x, "5e-6") for x in "42,1337,2333,2022,1213,43,1338,2334,2023,1214".split(",") ], time_threashold="2022-02-21 00:27:18", use_soft_score=use_soft_score)471# clear_and_print(all_results)472# all_results = []473# get_log_path = lambda prefix, task_name: f"logs/bart0-zeroshot_SentenceTransformer/RET_SentenceTransformer-unsupervised_rerank-64-1024-{prefix[0]}-all-{prefix[1]}-1.log" 474# all_results += process_exp(get_log_path, [(x, "5e-6") for x in "42,1337,2333,2022,1213,43,1338,2334,2023,1214".split(",") ], time_threashold="2022-02-12 00:27:18", use_soft_score=use_soft_score)475# clear_and_print(all_results)476# all_results = []477# clear_and_print(all_results)478# all_results = []479# # For Few-Shot Evalution480# get_log_path = lambda prefix, task_name: f"logs_backup/bart0-fewshot/FS_none-{prefix[0]}-{prefix[2]}-{task_name}-{prefix[1]}-{prefix[3]}.log" # for Few-shot481# all_results += process_exp(get_log_path, [(64, "1e-5", "True", 10)], time_threashold="2022-01-24 12:27:18", use_soft_score=use_soft_score)482# clear_and_print(all_results)483# all_results = []484# get_log_path = lambda prefix, task_name: f"logs/bart0-fewshot_Random/RET_Random-two-stage_no-{prefix[0]}-1024-42-{task_name}-5e-6-2.log" # for Few-shot485# all_results += process_exp(get_log_path, [("64", )], time_threashold="2022-02-11 00:27:18", use_soft_score=use_soft_score)486# clear_and_print(all_results)487# all_results = []488# get_log_path = lambda prefix, task_name: f"logs/bart0-fewshot_Random/RET_Random-two-stage_rerank-{prefix[0]}-1024-42-{task_name}-5e-6-2.log" # for Few-shot489# all_results += process_exp(get_log_path, [("64", )], time_threashold="2022-02-15 00:27:18", use_soft_score=use_soft_score)490# clear_and_print(all_results)491# get_log_path = lambda prefix, task_name: f"logs/bart0-fewshot_Random/RET_Random-mix-{prefix[0]}-512-42-{task_name}-6e-6-2.log" # for Few-shot492# all_results += process_exp(get_log_path, [("64", )], time_threashold="2022-01-11 00:27:18")493# logs/bart0-fewshot_Random/RET_Random-two-stage-64-512-42-ai2_arc-ARC-Challenge-6e-6-2.log494# # # For Zero-Shot + Random Ret Evalution495# get_log_path = lambda prefix, task_name: f"logs/BART0-zeroshot-retriever/random-{prefix[0]}-{task_name}/BART0-Random-{prefix[0]}-3331-3e-6-{prefix[1]}-zs-{task_name}.log" # for Few-shot496# all_results += process_exp(get_log_path, [(42, 200), (1337, 200), (2022, 200), (1213, 200), (2333, 200),])497# --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------498# For CSR-related499# all_results += process_exp(get_log_path, ["BART0_CSR"], time_threashold="2022-01-25 00:27:18", use_soft_score=use_soft_score) # , "T0_3B"500# get_log_path = lambda prefix, task_name: f"logs/csr-fewshot/FS_BART_none-{prefix[0]}-{prefix[2]}-{task_name}-{prefix[1]}-{prefix[3]}.log" # for Few-shot501# all_results += process_exp(get_log_path, [502# # (64, "1e-5", "True", 10, "v1"),503# (64, "1e-5", "True", 5, "v1")], time_threashold="2022-01-24 12:27:18")504# get_log_path = lambda prefix, task_name: f"logs/csr-fewshot/FS_BART0_CSR_none-{prefix[0]}-{prefix[2]}-{task_name}-{prefix[1]}-{prefix[3]}.log" # for Few-shot505# all_results += process_exp(get_log_path, [(64, "1e-5", "True", 5, "v2")], time_threashold="2022-01-24 12:27:18")506# get_log_path = lambda prefix, task_name: f"logs/csr-fewshot_Random/RET_BART_Random-two-stage-{prefix[0]}-512-42-{task_name}-6e-6-2.log" # for Few-shot507# all_results += process_exp(get_log_path, [("64", "Random" )], time_threashold="2022-01-11 00:27:18")508# get_log_path = lambda prefix, task_name: f"logs/csr-fewshot_{prefix[1]}/RET_BART0_CSR_{prefix[1]}-two-stage-{prefix[0]}-512-42-{task_name}-1e-5-3.log" # for Few-shot509# all_results += process_exp(get_log_path, [("64", "Random")], time_threashold="2022-01-11 00:27:18")510# all_results += process_exp(get_log_path, [("64", "SentenceTransformer")], time_threashold="2022-01-11 00:27:18")511# all_results += process_exp(get_log_path, [("64", "BART")], time_threashold="2022-01-11 00:27:18")512# Viz513# all_results_pd = pd.DataFrame(all_results).sort_values(by=['task']).drop_duplicates().groupby("task").sum().reset_index()514# all_results_pd = pd.DataFrame(all_results).sort_values(by=['task']).drop_duplicates().groupby("task").sum().reset_index()515# pd.options.display.float_format = '{:.2%}'.format516# print(all_results_pd)517# print(all_results_pd.to_csv(index=False))518# print(all_results_pd[["task", "BART0", "Random-0s@0", "SBERT-0s@0", "BART-0s@0"]].to_csv(index=False))519# print(all_results_pd[["task", "BART0", "Random-0s@1", "SBERT-0s@1", "BART-0s@1"]].to_csv(index=False))520# print(all_results_pd[["task", "BART0", "Random-0s@2", "SBERT-0s@2", "BART-0s@2"]].to_csv(index=False))521# print(all_results_pd[["task", "BART0", "Random-0s@3", "SBERT-0s@3", "BART-0s@3"]].to_csv(index=False))...

Full Screen

Full Screen

log.py

Source:log.py Github

copy

Full Screen

...8 try:9 message = """{timestamp};{context};{alert_type};{title};{short_description};{description}""".\10 format(timestamp=timestamp,context=context,alert_type=alert_type,title=title,\11 short_description=short_description,description=description)12 path,filename = split(get_log_path())13 if not exists(path):14 makedirs(path)15 if not exists(get_log_path()):16 with open(get_log_path(), 'w'): pass17 f = open(get_log_path(), 'a')18 f.write(message+'\n')19 except Exception as e:20 print(e)21def readLog():22 df = pd.DataFrame()23 if exists(get_log_path()):24 df = pd.read_csv(get_log_path(), sep=';', names=['TIMESTAMP','CONTEXT','ALERT_TYPE','TITLE','SHORT_DESCRIPTION', \25 'DESCRIPTION'], engine='python') #,nrows=get_log_max_rows())26 df = df.sort_values(by=['TIMESTAMP'], ascending=False)27 return df[:get_log_max_rows()]28 return df29def readLastLogs():30 df = pd.DataFrame()31 if exists(get_log_path()):32 df = pd.read_csv(get_log_path(), sep=';', names=['TIMESTAMP','CONTEXT','ALERT_TYPE','TITLE','SHORT_DESCRIPTION', \33 'DESCRIPTION'], engine='python') #,nrows=5)34 df = df.sort_values(by=['TIMESTAMP'], ascending=False)35 return df[:5]...

Full Screen

Full Screen

literales.py

Source:literales.py Github

copy

Full Screen

...20 21 return literal_txt22 23# Devuele información de tag dentro de LOGS24def get_log_path( name ):25 parent = 'LOGS'26 return get_literal(name, parent)27PATH_DEBUG = get_log_path('path_debug')28PATH_ERROR = get_log_path('path_error')29PATH_INFO = get_log_path('path_info')30PATH_WARN = get_log_path('path_warn')31NAME_DEBUG = get_log_path('name_debug')32NAME_ERROR = get_log_path('name_error')33NAME_INFO = get_log_path('name_info')34NAME_WARN = get_log_path('name_warn')35# CONST36# COLORS37COLOR_SUCCESS = '#00ff00' # Green38COLOR_INACTIVE = '#ffff66' # Yellow39COLOR_DANGER = '#ff0000' # Red40COLOR_DANGER_ACTIVE = '#cc0000' # Darker red41COLOR_WHITE = '#fff'42COLOR_BLACK = '#000'43COLOR_INTERMITENTE = '#FFC300'44COLOR_DISABLED = '#a1a5ab'45BG_COLOR = '#f5f5dc'46# FONTS47FONT_STYLE_TXT = ('Helvetica' , 14)48FONT_STYLE_TITLE = ('Helvetica' , 16, 'bold')...

Full Screen

Full Screen

test_monkey_log_path.py

Source:test_monkey_log_path.py Github

copy

Full Screen

...4 if log_path.is_file():5 log_path.unlink()6@pytest.mark.parametrize("get_log_path", [get_agent_log_path, get_dropper_log_path])7def test_subsequent_calls_return_same_path(get_log_path):8 log_path_1 = get_log_path()9 assert log_path_1.is_file()10 log_path_2 = get_log_path()11 assert log_path_1 == log_path_212 delete_log_file(log_path_1)13def test_agent_dropper_paths_differ():14 agent_log_path = get_agent_log_path()15 dropper_log_path = get_dropper_log_path()16 assert agent_log_path != dropper_log_path17 for log_path in [agent_log_path, dropper_log_path]:...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tox automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful