# Duplicate examples shown even though my custom recipe generates them once

**URL:** <https://support.prodi.gy/t/duplicate-examples-shown-even-though-my-custom-recipe-generates-them-once/2981>\
**Category:** Uncategorized\
**Tags:** done, streams\
**Created:** [June 3, 2020, 1:22pm UTC](https://support.prodi.gy/t/duplicate-examples-shown-even-though-my-custom-recipe-generates-them-once/2981 "2020-06-03T13:22:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![geniki](https://avatars.discourse-cdn.com/v4/letter/g/ecb155/32.png) [@geniki](https://support.prodi.gy/u/geniki)\
**Post date:** [June 3, 2020, 1:22pm UTC](https://support.prodi.gy/t/duplicate-examples-shown-even-though-my-custom-recipe-generates-them-once/2981/1 "2020-06-03T13:22:10Z")

</div>

I have a custom recipe that does some amount of data transformation (e.g. creating multiple examples from one input) but by having it print everything just before the `yield` statement, it seems to generate the examples I want, each with unique input and task hashes.

However, when I start annotating I see duplication. With default `batch_size` 10 and if I start indexing the examples I see from the `print` just before `yield task` from 1, the pattern is  
1, 2, 3,.... 22, 23, 1, 2, (and I stop tracking).  
With `batch_size` 1, the pattern is  
1, 2, 3, 1, 2, 3, 4, 5, 6, 4, 5, 6, ... (i.e. it seems every 3 examples are shown twice and then we move on to the next 3)

If I `db-out` a dataset generated by this, the resulting jsonl has the duplicate entries - the whole lines are exactly the same, including the hashes (assuming same annotation on both passes).

`exclude_by` is left/set to `task`, which I thought should not allow the above to occur.

I'm using Prodigy 1.9.9, default DB.

Any thoughts?

---

<div class="post-metadata">

**Author:** ![cgreco](https://avatars.discourse-cdn.com/v4/letter/c/54ee81/32.png) [@cgreco](https://support.prodi.gy/u/cgreco)\
**Post date:** [June 3, 2020, 6:13pm UTC](https://support.prodi.gy/t/duplicate-examples-shown-even-though-my-custom-recipe-generates-them-once/2981/2 "2020-06-03T18:13:57Z")

</div>

Mabye related to [textcat.manual Duplicate Samples](https://support.prodi.gy/t/textcat-manual-duplicate-samples/2962)?

---

<div class="post-metadata">

**Author:** ![ines](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ines/32/3_2.png) [@ines](https://support.prodi.gy/u/ines)\
**Post date:** [June 4, 2020, 8:39am UTC](https://support.prodi.gy/t/duplicate-examples-shown-even-though-my-custom-recipe-generates-them-once/2981/3 "2020-06-04T08:39:40Z")

</div>

@geniki Could you share the code that generates the examples and your recipe config settings? It's otherwise a bit hard to help debug this, because there could be a lot of explanations.

---

<div class="post-metadata">

**Author:** ![geniki](https://avatars.discourse-cdn.com/v4/letter/g/ecb155/32.png) [@geniki](https://support.prodi.gy/u/geniki)\
**Post date:** [June 4, 2020, 9:57am UTC](https://support.prodi.gy/t/duplicate-examples-shown-even-though-my-custom-recipe-generates-them-once/2981/4 "2020-06-04T09:57:20Z")

</div>

@cgreco thanks, I missed your thread and the related one here [Refresh browser fix with force\_stream\_order](https://support.prodi.gy/t/refresh-browser-fix-with-force-stream-order/2949).

As suggested in that thread, I tried setting `force_stream_order` to `False` and that removes the duplication but it turns off an equally important feature.

Unlike the others, I was not using a named session. I tried with a named session and got the same results.

@ines it's not always quick to create a new recipe with the same logic and that is shareable on a public forum. I thought confirming that I'm happy with the output of the recipe from it's `yield` statement is a good checkpoint. I'll try to create a self-sufficient case but at the moment it seems that the problem is more general given the other threads.

---

<div class="post-metadata">

**Author:** ![justindujardin](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/justindujardin/32/169_2.png) [@justindujardin](https://support.prodi.gy/u/justindujardin)\
**Post date:** [June 4, 2020, 3:38pm UTC](https://support.prodi.gy/t/duplicate-examples-shown-even-though-my-custom-recipe-generates-them-once/2981/5 "2020-06-04T15:38:21Z")

</div>

Hi @geniki,

I was able to reproduce duplicate examples seen in the client using `force_stream_order=True`, and I'm debugging it.

Thanks for reporting, I'll update this thread once I've found the root cause and a fix.

---

<div class="post-metadata">

**Author:** ![ines](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ines/32/3_2.png) [@ines](https://support.prodi.gy/u/ines)\
**Post date:** [June 5, 2020, 6:58pm UTC](https://support.prodi.gy/t/duplicate-examples-shown-even-though-my-custom-recipe-generates-them-once/2981/6 "2020-06-05T18:58:09Z")

</div>

Just released v1.9.10, which should fix the underlying problem with `force_stream_order` (explained in detail by @justindujardin [in this post](https://support.prodi.gy/t/refresh-browser-fix-with-force-stream-order/2949/11)). The only case where a glitch may still be possible with the current implementation is if you hold down a hotkey and rapid fire – but that should also be a pretty unusual scenario.
