cleanup dataset.map functions

This commit is contained in:
bentrevett 2021-07-08 11:26:28 +01:00
parent 0b62a21dc0
commit bc5e0f492a
2 changed files with 6 additions and 6 deletions

View File

@ -127,8 +127,8 @@
"outputs": [],
"source": [
"def tokenize_data(example, tokenizer, max_length):\n",
" tokens = {'tokens': tokenizer(example['text'])[:max_length]}\n",
" return tokens"
" tokens = tokenizer(example['text'])[:max_length]\n",
" return {'tokens': tokens}"
]
},
{
@ -861,8 +861,8 @@
"outputs": [],
"source": [
"def numericalize_data(example, vocab):\n",
" ids = {'ids': [vocab[token] for token in example['tokens']]}\n",
" return ids"
" ids = [vocab[token] for token in example['tokens']]\n",
" return {'ids': ids}"
]
},
{

View File

@ -170,8 +170,8 @@
"outputs": [],
"source": [
"def numericalize_data(example, vocab):\n",
" ids = {'ids': [vocab[token] for token in example['tokens']]}\n",
" return ids"
" ids = [vocab[token] for token in example['tokens']]\n",
" return {'ids': ids}"
]
},
{