Skip to content

Commit

Permalink
OpenQA: pass the k to the evaluate_retrieval_example from the success@k
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianHurubaru committed Jan 5, 2023
1 parent 451efb9 commit 938efa9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions hw_openqa.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1648,7 +1648,7 @@
"def success_at_k(examples, k=20):\n",
" scores = []\n",
" for ex in examples: \n",
" scores.append(evaluate_retrieval_example(ex, k=5))\n",
" scores.append(evaluate_retrieval_example(ex, k=k))\n",
" return sum(scores) / len(scores)\n",
" \n",
" \n",
Expand Down Expand Up @@ -1686,11 +1686,11 @@
"%%time\n",
"if torch.cuda.is_available():\n",
" # This will take a few hours on a CPU:\n",
" print(success_at_k(squad_dev))\n",
" print(success_at_k(squad_dev, k=5))\n",
"else:\n",
" # This should be reasonably fast and yields the\n",
" # same kind of result:\n",
" print(success_at_k(dev_exs))"
" print(success_at_k(dev_exs, k=5))"
]
},
{
Expand Down

0 comments on commit 938efa9

Please sign in to comment.