# Seeding everything to get the same masked words

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fseeding-everything-to-get-the-same-masked-words%2F39144%3E%5C
**Category:** 🤗Datasets\
**Created:** [May 9, 2023, 1:33am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fseeding-everything-to-get-the-same-masked-words%2F39144 "2023-05-09T01:33:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![surya-narayanan](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@surya-narayanan](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsurya-narayanan)%5C
**Post date:** [May 9, 2023, 1:33am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fseeding-everything-to-get-the-same-masked-words%2F39144%2F1 "2023-05-09T01:33:01Z")

</div>

Hi,

I am using a few different libraries (torch, hf transformers, lightning) so please feel free to let me know if this is outside the hf forum’s wheelhouse.

I have two datasets, for which I want to create two dataloaders that and want to mask the same tokens in each.

I tried `L.seed_everything()` and was unable to get what I want.

Does anyone have any suggestions? My code is here: [Google Colab](https://colab.research.google.com/drive/13aJSCQTj5X0KIHrkhoxwAkbr5RYtPhE4?usp=sharing)

---

<div class="post-metadata">

**Author:** ![lhoestq](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/lhoestq/32/64813_2.png) [@lhoestq](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Flhoestq)%5C
**Post date:** [May 12, 2023, 9:38am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fseeding-everything-to-get-the-same-masked-words%2F39144%2F2 "2023-05-12T09:38:57Z")

</div>

Your two data collators share the same random generator, so they don’t sample the same random masks.

You can try copying the `DataCollatorForLanguageModeling` code and set a random generator that uses a fixed seed at initialization
