# "Avoid using tokenizers before the fork"?

**URL:** <https://community.deeplearning.ai/t/avoid-using-tokenizers-before-the-fork/599789>\
**Category:** Open Source Models with Hugging Face\
**Created:** [March 27, 2024, 10:51pm UTC](https://community.deeplearning.ai/t/avoid-using-tokenizers-before-the-fork/599789 "2024-03-27T22:51:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kronsteen](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/kronsteen/32/82829_2.png) [@kronsteen](https://community.deeplearning.ai/u/kronsteen)\
**Post date:** [March 27, 2024, 10:51pm UTC](https://community.deeplearning.ai/t/avoid-using-tokenizers-before-the-fork/599789/1 "2024-03-27T22:51:00Z")

</div>

Running locally on M2 MacBook Air. Following along with the instructions in _Lesson 3: Translation and Summarization_.

What does this mean?

> Avoid using `tokenizers` before the fork if possible

Not really sure what path to take following this warning:

 ![Screenshot 2024-03-27 at 3.47.20 PM](https://global.discourse-cdn.com/dlai/original/3X/f/2/f2ea59dfa7566d6804c5370ab7b071d191cf2b19.png)

---

<div class="post-metadata">

**Author:** ![Deepti\_Prasad](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/deepti_prasad/32/178017_2.png) [@Deepti\_Prasad](https://community.deeplearning.ai/u/Deepti_Prasad)\
**Post date:** [March 28, 2024, 4:31pm UTC](https://community.deeplearning.ai/t/avoid-using-tokenizers-before-the-fork/599789/2 "2024-03-28T16:31:01Z")

</div>

> [@kronsteen](#):
>
> Hello @kronsteen
> 
> > Avoid using `tokenizers` before the fork if possible

the above warning is given to avoid fasttokenizer.

This could be done either by setting environment variable to the string “false” or  
TOKENIZERS\_PARALLELISM=false

Check the below link

> <https://stackoverflow.com/questions/62691279/how-to-disable-tokenizers-parallelism-true-false-warning>

Although I am also tagging an NLP mentor if he could add anything more. @arvyzukai can you please have a look at this doubt. thank you.

Regards  
DP

---

<div class="post-metadata">

**Author:** ![arvyzukai](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/arvyzukai/32/165165_2.png) [@arvyzukai](https://community.deeplearning.ai/u/arvyzukai)\
**Post date:** [March 29, 2024, 9:05am UTC](https://community.deeplearning.ai/t/avoid-using-tokenizers-before-the-fork/599789/3 "2024-03-29T09:05:49Z")

</div>

Hi,

The Allohvk’s answer in the stackoverflow link pretty much explains everything. I’m not familiar with the code (as I understand - the short course notebook) in details (which might matter), but what comes to mind is that you probably called the tokenizer prior to training (you might have tried it to see what the outputs of the tokenizer are in your notebook - you wouldn’t want that in “real” training).  
In other words, you can ignore the warning when learning, but if you want the efficiency (for production) you should pay attention and adapt the code accordingly.

Cheers

---

<div class="post-metadata">

**Author:** ![kronsteen](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/kronsteen/32/82829_2.png) [@kronsteen](https://community.deeplearning.ai/u/kronsteen)\
**Post date:** [March 29, 2024, 5:29pm UTC](https://community.deeplearning.ai/t/avoid-using-tokenizers-before-the-fork/599789/4 "2024-03-29T17:29:35Z")

</div>

Since I am learning all this for the first time, it’s confusing to get (what looks like) a serious warning when using the provided course notebook.

> but what comes to mind is that you probably called the tokenizer prior to training

I only cut and pasted whatever was in the course notebook.

> if you want the efficiency (for production) you should pay attention and adapt the code accordingly

Of course I’d prefer to write my own code without inefficiencies, but then it’s confusing that the course uses “bad practices” - if that’s what is happening.

Now that I’m further into the course, I realize that this course is only a survey, so I’m not stressing about the warnings. Perhaps there are other in-depth courses that explain how to do just one method - using “accurate code”? I appreciate your recommendations - thanks!

---

<div class="post-metadata">

**Author:** ![arvyzukai](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/arvyzukai/32/165165_2.png) [@arvyzukai](https://community.deeplearning.ai/u/arvyzukai)\
**Post date:** [April 8, 2024, 6:20am UTC](https://community.deeplearning.ai/t/avoid-using-tokenizers-before-the-fork/599789/5 "2024-04-08T06:20:23Z")

</div>

> [@kronsteen](#):
>
> Perhaps there are other in-depth courses that explain how to do just one method - using “accurate code”?

Again, I’m answering “blind” here (I don’t see the Notebooks) but, generally there are no courses that dive deep into some implementations (for example, some particular hugging face model implementation) because the landscape is changing too fast (creating courses takes time, attracting learners takes time, suddenly the new trending topic comes along and the course would become irrelevant).  
Usually, you would carefully read the hugging face documentation and check the source code for methods that you care (especially when documentation is not very helpful). Sometimes the specifics are framework related, then posts like the Deepti linked on stackoverflow are the ones to look for. If that does not answer the question, you would dig deeper in the [PyTorch forums](https://discuss.pytorch.org/).  
As for developing “accurate code” (broadly speaking) you would look for language related courses.  
In other words, I wish I had a better answer, but this is what comes to mind.

Cheers
