# Using a dataset with already masked tokens

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fusing-a-dataset-with-already-masked-tokens%2F3436%3E%5C
**Category:** Beginners\
**Created:** [January 29, 2021, 5:26pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fusing-a-dataset-with-already-masked-tokens%2F3436 "2021-01-29T17:26:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lindasteel](https://avatars.discourse-cdn.com/v4/letter/l/94ad74/32.png) [@Lindasteel](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FLindasteel)%5C
**Post date:** [January 29, 2021, 5:26pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fusing-a-dataset-with-already-masked-tokens%2F3436%2F1 "2021-01-29T17:26:37Z")

</div>

I am trying to fine tune BERT for Masked Language Modeling and I would like to use a dataset that already contains masked tokens (I want to mask particular words rather than randomly chosen ones).  
How can I do this?  
I am following these [https://colab.research.google.com/github/huggingface/notebooks/blob/master/examples/language\_modeling.ipynb#scrollTo=KDBi0reX3l\_g](https://colab.research.google.com/github/huggingface/notebooks/blob/master/examples/language_modeling.ipynb#scrollTo=KDBi0reX3l_g)  
instructions, but I am not sure which parts of the code I need to change for it to be compatible with a dataset that already has [MASK] tokens in it.  
Thanks!

---

<div class="post-metadata">

**Author:** ![sgugger](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/sgugger/32/2291_2.png) [@sgugger](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsgugger)%5C
**Post date:** [January 29, 2021, 7:20pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fusing-a-dataset-with-already-masked-tokens%2F3436%2F2 "2021-01-29T19:20:32Z")

</div>

The masking is done by the data collator `DataCollatorForLanguageModeling`. Just pass along `mlm=False` to that data collator to deactivate the random masking there.

---

<div class="post-metadata">

**Author:** ![Lindasteel](https://avatars.discourse-cdn.com/v4/letter/l/94ad74/32.png) [@Lindasteel](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FLindasteel)%5C
**Post date:** [February 3, 2021, 4:47pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fusing-a-dataset-with-already-masked-tokens%2F3436%2F3 "2021-02-03T16:47:22Z")

</div>

Thank you so much!
