# Mute Faiss search progress bar

**URL:** <https://discuss.huggingface.co/t/mute-faiss-search-progress-bar/160125>\
**Category:** 🤗Datasets\
**Created:** [June 20, 2025, 8:42pm UTC](https://discuss.huggingface.co/t/mute-faiss-search-progress-bar/160125 "2025-06-20T20:42:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MagicLuke](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/magicluke/32/44922_2.png) [@MagicLuke](https://discuss.huggingface.co/u/MagicLuke)\
**Post date:** [June 20, 2025, 8:42pm UTC](https://discuss.huggingface.co/t/mute-faiss-search-progress-bar/160125/1 "2025-06-20T20:42:34Z")

</div>

Hi,

I am using the faiss feature from datasets which is very helpful and easy, except for there is a wired progress bar that I don’t know how to turn off.

The code I am using

```auto
datastore = datastore.add_faiss_index(column=self.knn_on, faiss_verbose=False)
            query = np.asarray(sample[self.knn_on])
            _scores, fewshots_examples = datastore.get_nearest_examples(
                index_name=self.knn_on,
                query=query,
                k=k,
            )

```

And the terminal will keep logging progress bar as the snapshot below:

 ![image](https://us1.discourse-cdn.com/hellohellohello/original/3X/e/2/e24e0e288aa8bf68864f5f75205502dc60f62e5b.png)

I am wondering is there any way I can mute it?

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [June 21, 2025, 1:05am UTC](https://discuss.huggingface.co/t/mute-faiss-search-progress-bar/160125/2 "2025-06-21T01:05:49Z")

</div>

Hmm… This?

> <https://github.com/huggingface/datasets/issues/1627>
>
> I can't find anything to turn off the \`tqdm\` progress bars while running a prepr…ocessing function using \`Dataset.map\`. I want to do akin to \`disable\_tqdm=True\` in the case of \`transformers\`. Is there something like that?

---

<div class="post-metadata">

**Author:** ![MagicLuke](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/magicluke/32/44922_2.png) [@MagicLuke](https://discuss.huggingface.co/u/MagicLuke)\
**Post date:** [June 21, 2025, 3:51am UTC](https://discuss.huggingface.co/t/mute-faiss-search-progress-bar/160125/3 "2025-06-21T03:51:47Z")

</div>

I think it’s not from the map method but from either the add index or the find nearest method. Because it only show up when I include that logic and map has its own progress bar. Plus I want to keep the map’s tqdm while mute the 1/1 one. Is that possible

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [June 21, 2025, 4:39am UTC](https://discuss.huggingface.co/t/mute-faiss-search-progress-bar/160125/4 "2025-06-21T04:39:43Z")

</div>

> Plus I want to keep the map’s tqdm while mute the 1/1 one. Is that possible

I think it’s possible, but without modifying the contents of the library, the only option is to manually silence tqdm temporarily like this… Or `add_faiss_index_from_external_arrays` for better tqdm?  
[https://stackoverflow.com/questions/37091673/silence-tqdms-output-while-running-tests-or-running-the-code-via-cron](https://stackoverflow.com/questions/37091673/silence-tqdms-output-while-running-tests-or-running-the-code-via-cron)

> [@Add\_faiss\_index usage example](https://discuss.huggingface.co/t/add-faiss-index-usage-example/2925):
>
> Hi, I am trying to know how to use Rag/DPR, but first I want to get familiar with faiss usage. I checked the official example in But it seems the snippet code is not self-executable. So I did some modification, aiming to retrieve similar examples in the sst2 dataset with query ‘I am happy’. import datasets from transformers import pipeline embed = pipeline('sentiment-analysis', model="nlptown/bert-base-multilingual-uncased-sentiment") ds = datasets.load\_dataset('glue', 'sst2', split='test')…

[https://stackoverflow.com/questions/62048408/how-to-remove-progressbar-in-tqdm-once-the-iteration-is-complete](https://stackoverflow.com/questions/62048408/how-to-remove-progressbar-in-tqdm-once-the-iteration-is-complete)

> **[Main classes](https://huggingface.co/docs/datasets/package_reference/main_classes#datasets.Dataset.add_faiss_index_from_external_arrays)**
>
> We’re on a journey to advance and democratize artificial intelligence through open source and open science.

---

<div class="post-metadata">

**Author:** ![MagicLuke](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/magicluke/32/44922_2.png) [@MagicLuke](https://discuss.huggingface.co/u/MagicLuke)\
**Post date:** [July 1, 2025, 9:57pm UTC](https://discuss.huggingface.co/t/mute-faiss-search-progress-bar/160125/5 "2025-07-01T21:57:10Z")

</div>

Thanks for the answer.

I muted it by modifying the `add_vectors` method under the FaissIndex class

from

```auto
 for i in hf_tqdm(range(0, len(vectors), batch_size)): # Original

```

to

```auto
for i in hf_tqdm(range(0, len(vectors), batch_size), disable=(not faiss_verbose)): # disable 

```
