加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
eval_figures.py 791 Bytes
一键复制 编辑 原始数据 按行查看 历史
bstadt 提交于 2023-03-28 20:22 . updated eval
import glob
import pickle
import numpy as np
from matplotlib import pyplot as plt
plt.figure()
for fpath in glob.glob('./eval_data/*.pkl'):
parts = fpath.split('__')
model_name = parts[1].replace('model-', '').replace('.pkl', '')
lora_name = parts[2].replace('lora-', '').replace('.pkl', '')
with open(fpath, 'rb') as f:
data = pickle.load(f)
perplexities = data['perplexities']
perplexities = np.nan_to_num(perplexities, 100)
perplexities = np.clip(perplexities, 0, 100)
if 'nomic' in fpath:
label = 'GPT4all-lora'
else:
label = 'alpaca-lora'
plt.hist(perplexities, label=label, alpha=.5)
plt.xlabel('Perplexity')
plt.ylabel('Frequency')
plt.legend()
plt.savefig('figs/perplexity_hist.png')
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化