# NameError when tokenizing with num\_proc

**URL:** <https://discuss.huggingface.co/t/nameerror-when-tokenizing-with-num-proc/17630>\
**Category:** Course\
**Created:** [May 7, 2022, 6:03am UTC](https://discuss.huggingface.co/t/nameerror-when-tokenizing-with-num-proc/17630 "2022-05-07T06:03:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pete88b](https://avatars.discourse-cdn.com/v4/letter/p/3bc359/32.png) [@pete88b](https://discuss.huggingface.co/u/pete88b)\
**Post date:** [May 7, 2022, 6:03am UTC](https://discuss.huggingface.co/t/nameerror-when-tokenizing-with-num-proc/17630/1 "2022-05-07T06:03:28Z")

</div>

On my windows machine, running the multiprocessing code in [The `map()` method’s superpowers](https://huggingface.co/course/chapter5/3?fw=pt#the-map-methods-superpowers) fails with `"NameError: name 'slow_tokenizer' is not defined"`

Binding `slow_tokenizer` as a `slow_tokenize_function` parameter makes the code run …

```auto
slow_tokenizer = AutoTokenizer.from_pretrained("bert-base-cased", use_fast=False)
def slow_tokenize_function(examples, slow_tokenizer=slow_tokenizer):
    return slow_tokenizer(examples["review"], truncation=True)
tokenized_dataset = drug_dataset.map(slow_tokenize_function, batched=True, num_proc=8)

```

… but it’s much slower than without `num_proc` - I think the python multiprocessing issues on Jupyter and Windows are pretty well know (o:
