# Multithreading with map

**URL:** <https://discuss.huggingface.co/t/multithreading-with-map/29936>\
**Category:** 🤗Datasets\
**Created:** [January 18, 2023, 8:53am UTC](https://discuss.huggingface.co/t/multithreading-with-map/29936 "2023-01-18T08:53:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Muennighoff](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/muennighoff/32/11884_2.png) [@Muennighoff](https://discuss.huggingface.co/u/Muennighoff)\
**Post date:** [January 18, 2023, 8:53am UTC](https://discuss.huggingface.co/t/multithreading-with-map/29936/1 "2023-01-18T08:53:21Z")

</div>

Is it possible to use multithreading with `dataset.map(...)`? I’m currently using multiprocessing via `num_proc`, but it’s too slow as my processing function makes Internet requests.  
Using more threads via multithreading could speed it up, no?  
cc @lhoestq 🤗

---

<div class="post-metadata">

**Author:** ![lhoestq](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/lhoestq/32/64813_2.png) [@lhoestq](https://discuss.huggingface.co/u/lhoestq)\
**Post date:** [January 23, 2023, 1:17pm UTC](https://discuss.huggingface.co/t/multithreading-with-map/29936/2 "2023-01-23T13:17:35Z")

</div>

Hi ! I think you’d need to implement the multithreading in the function you pass to `map`
