Skip to content

Instantly share code, notes, and snippets.

@hamelsmu
Created July 3, 2022 03:57
Show Gist options
  • Save hamelsmu/f1989fb35fd5c1f2935dcefe41cbfe64 to your computer and use it in GitHub Desktop.
Save hamelsmu/f1989fb35fd5c1f2935dcefe41cbfe64 to your computer and use it in GitHub Desktop.
Get Validation Predictions For Lesson 3 wandb
import wandb
import pandas as pd
from fastcore.all import Path
def val_pred_table(run_id, entity='wandb_course', proj='lemon-project'):
"Get prediction table on the validation set for the lemon project."
api = wandb.Api()
path = api.artifact(f'{entity}/{proj}/run-{run_id}-predictions_table:v0').download()
preds = (Path(path)/'predictions_table.table.json').read_json()
return pd.DataFrame([{'pred':p, 'label':t} for _,p,_,t in preds['data']])
if __name__ == '__main__':
preds = val_pred_table('zxum4ef0')
preds.to_excel(Path('Validtation_Predictions.xlsx'))
@hamelsmu
Copy link
Author

hamelsmu commented Jul 4, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment