fix: prevent N×M reply explosion in HuggingFaceLocalGenerator with multiple stop_words#11413
Conversation
|
Someone is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
|
@NIK-TIGER-BILL Thank you for opening this pull request. Would you please agree to our CLA? Otherwise we can't merge this pull request. #11413 (comment) |
Done! |
|
@NIK-TIGER-BILL Your commit in this pull request appears not to be linked to your user account. Could you please fix that? Here are instructions: https://docs.github.com/en/pull-requests/committing-changes-to-your-project/troubleshooting-commits/why-are-my-commits-linked-to-the-wrong-user#commits-are-not-linked-to-any-user |
|
@julian-risch The commit author is already set to |
|
@NIK-TIGER-BILL Unfortunately, the problem with the CLA is not solved yet in this PR. What you did in this other PR #11385 solved the problem there. Did you force push already? |
fa48350 to
49c4c0f
Compare
|
@julian-risch Done — I rebased the branch on latest |
…ltiple stop_words Signed-off-by: NIK-TIGER-BILL <59732804+NIK-TIGER-BILL@users.noreply.github.com>
49c4c0f to
47bb794
Compare
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Related Issues
Proposed Changes:
The list comprehension in
HuggingFaceLocalGenerator.run()used twoforclauses to remove stop words from replies:This creates a cross-product: with N replies and M stop words the output contains N×M replies instead of N. Half of the extra replies still contain the stop word, and downstream components receive an unexpected number of replies.
The fix replaces the comprehension with an explicit outer loop over
stop_words, matching the already-correct implementation inHuggingFaceChatLocalGenerator(chat/hugging_face_local.py, line 654):How did you test it?
test_run_multiple_stop_words_removalthat mocks a pipeline returning 2 replies with 2 stop words configured.Notes for the reviewer
This is a minimal, surgical change. The sibling chat generator already uses the same sequential approach, so this only brings the non-chat generator in line with the existing pattern.
Checklist
fix: ....This PR was fully generated with an AI assistant. I have reviewed the changes and run the relevant tests.