def main(args):
    plot_bar = False
    df = pd.read_json(args.eval_path, dtype={'model': str, 'epoch': str})
    df = df.explode('metrics').reset_index()
    df = df.drop('metrics', axis=1).join(pd.DataFrame(df.metrics.values.tolist())).drop('index', axis=1)
    df.rename(columns={'it': 'input/target', 'ot': 'output/target'}, inplace=True)
    blacklisted_trainer_ids = ['1646936119.3354385', '1646987487.7802982', '1647161196.55366']
    df = df.loc[df['model'].apply((lambda x: (x not in blacklisted_trainer_ids)))]
    df = df.set_index(['model', 'epoch'])
    df = df.stack().to_frame(name='metrics')
    df.index.set_names('it_ot', level=2, inplace=True)
    df = df['metrics'].apply(pd.Series)
    df = df.reset_index()
    xticks = get_xticks(args.eval_path.parent, df['model'].to_list())
    df.insert(0, 'title', df['model'].apply((lambda v: xticks[v])))
    df = df.drop(['model', 'epoch'], axis=1)
    if plot_bar:
        generate_bar_plot(df)
    else:
        get_box_plot(df)
    plt.savefig(f'{args.eval_path.parent}/plt.png')
def main(args):
    plot_bar = False
    df = pd.read_json(args.eval_path, dtype={'model': str, 'epoch': str})
    df = df.explode('metrics').reset_index()
    df = df.drop('metrics', axis=1).join(pd.DataFrame(df.metrics.values.tolist())).drop('index', axis=1)
    df.rename(columns={'it': 'input/target', 'ot': 'output/target'}, inplace=True)
    blacklisted_trainer_ids = ['1646936119.3354385', '1646987487.7802982', '1647161196.55366']
    df = df.loc[df['model'].apply((lambda x: (x not in blacklisted_trainer_ids)))]
    df = df.set_index(['model', 'epoch'])
    df = df.stack().to_frame(name='metrics')
    df.index.set_names('it_ot', level=2, inplace=True)
    df = df['metrics'].apply(pd.Series)
    df = df.reset_index()
    xticks = get_xticks(args.eval_path.parent, df['model'].to_list())
    df.insert(0, 'title', df['model'].apply((lambda v: xticks[v])))
    df = df.drop(['model', 'epoch'], axis=1)
    if plot_bar:
        generate_bar_plot(df)
    else:
        get_box_plot(df)
    plt.savefig(f'{args.eval_path.parent}/plt.png')