Skip to content

Commit 6bdcc68

Browse files
committed
Validation too!
1 parent 69ac118 commit 6bdcc68

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

examples/question_answering.ipynb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1510,6 +1510,11 @@
15101510
"outputs": [],
15111511
"source": [
15121512
"def prepare_validation_features(examples):\n",
1513+
" # Some of the questions have lots of whitespace on the left, which is not useful and will make the\n",
1514+
" # truncation of the context fail (the tokenized question will take a lots of space). So we remove that\n",
1515+
" # left whitespace\n",
1516+
" examples[\"question\"] = [q.lstrip() for q in examples[\"question\"]]\n",
1517+
"\n",
15131518
" # Tokenize our examples with truncation and maybe padding, but keep the overflows using a stride. This results\n",
15141519
" # in one example possible giving several features when a context is long, each of those features having a\n",
15151520
" # context that overlaps a bit the context of the previous feature.\n",

0 commit comments

Comments
 (0)