# Cannot load fill-mask pipline with BertWordPieceTokenizer

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcannot-load-fill-mask-pipline-with-bertwordpiecetokenizer%2F39968%3E%5C
**Category:** Beginners\
**Created:** [May 15, 2023, 3:24pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcannot-load-fill-mask-pipline-with-bertwordpiecetokenizer%2F39968 "2023-05-15T15:24:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![timpal0l](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/timpal0l/32/16162_2.png) [@timpal0l](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Ftimpal0l)%5C
**Post date:** [May 15, 2023, 3:24pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcannot-load-fill-mask-pipline-with-bertwordpiecetokenizer%2F39968%2F1 "2023-05-15T15:24:38Z")

</div>

```auto
In [136]: tokenizer
Out[136]: Tokenizer(vocabulary_size=64000, model=BertWordPiece, unk_token=[UNK], sep_token=[SEP], cls_token=[CLS], pad_token=[PAD], mask_token=[MASK], clean_text=True, handle_chinese_chars=False, strip_accents=False, lowercase=False, wordpieces_prefix=##)

```

`fill_masker = pipeline(task="fill-mask", model=model, tokenizer=tokenizer)`

```auto
File ~/anaconda3/envs/transformers/lib/python3.11/site-packages/transformers/pipelines/fill_mask.py:211, in FillMaskPipeline._sanitize_parameters(self, top_k, targets)
    208 if top_k is not None:
    209 postprocess_params["top_k"] = top_k
--> 211 if self.tokenizer.mask_token_id is None:
    212 raise PipelineException(
    213 "fill-mask", self.model.base_model_prefix, "The tokenizer does not define a `mask_token`."
    214 )
    215 return {}, {}, postprocess_params

AttributeError: 'BertWordPieceTokenizer' object has no attribute 'mask_token_id'

```

It clearly says that the tokenizer have a mask\_token\_id called “[MASK]”.

It can decode this special token correctly:

```auto
In [140]: tokenizer.encode("[MASK]").ids
Out[140]: [2, 4, 3]

```
