Skip to content

Commit

Permalink
Updated so that padding is removed during decode. Fixes: fastai#2910
Browse files Browse the repository at this point in the history
  • Loading branch information
marii-moe committed Nov 3, 2020
1 parent 580742b commit f86d8fa
Show file tree
Hide file tree
Showing 2 changed files with 313 additions and 54 deletions.
2 changes: 1 addition & 1 deletion fastai/text/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class LMTensorText(TensorText): pass
# Cell
class Numericalize(Transform):
"Reversible transform of tokenized texts to numericalized ids"
def __init__(self, vocab=None, min_freq=3, max_vocab=60000, special_toks=None, pad_tok=None):
def __init__(self, vocab=None, min_freq=3, max_vocab=60000, special_toks=None, pad_tok=PAD):
store_attr('vocab,min_freq,max_vocab,special_toks,pad_tok')
self.o2i = None if vocab is None else defaultdict(int, {v:k for k,v in enumerate(vocab)})

Expand Down

0 comments on commit f86d8fa

Please sign in to comment.