Spaces:
Sleeping
Sleeping
from utils_display import model_info | |
from data_utils import load_infer_results | |
from tqdm import tqdm | |
import json | |
length_info = {} | |
for model_name in tqdm(list(model_info.keys())): | |
result = load_infer_results(model_name) | |
lens = [] | |
for item in result: | |
o = item["output"] | |
if type(o) == list: | |
L = len(o[0].strip()) | |
else: | |
L = len(o.strip()) | |
if L > 0: | |
lens.append(L) | |
avg_len = sum(lens) / len(lens) | |
print(f"{model_name}: {avg_len}") | |
length_info[model_name] = avg_len | |
with open("model_len_info.json", "w") as f: | |
json.dump(length_info, f, indent=2) | |