Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It looks like the prompt wasn't removed from the response when using the Hugging Face provider. #294

Open
danny-su opened this issue Nov 28, 2024 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@danny-su
Copy link

image

@Blarc
Copy link
Owner

Blarc commented Nov 28, 2024

Hey @danny-su, I'm pretty sure this is an issue with the LLM and not the plugin, since the plugin sets the message from the LLM's response.

Edit: Huh, unless this LLM returns the prompt in the response on purpose. Is this something that can be configured?

@danny-su
Copy link
Author

danny-su commented Nov 28, 2024

@Blarc You can remove the leading prompt by its length.

https://huggingface.co/docs/transformers/main/llm_tutorial

image

@Blarc Blarc self-assigned this Nov 29, 2024
@Blarc Blarc added the bug Something isn't working label Nov 29, 2024
@Blarc
Copy link
Owner

Blarc commented Nov 30, 2024

@danny-su I am still not exactly sure how to implement this.

  • Should I remove the first n characters, where n is the length of the prompt?
  • From the screenshot that you sent, I can see the prompt and the response are split by ---. This should also probably be removed? Maybe it would be more reliable to just remove everything before and including --- ?
  • Should I add option to all client configurations or do I enable this just for HuggingFace?

@danny-su
Copy link
Author

danny-su commented Dec 1, 2024

@Blarc You need to remove the first n characters; there is no option for this purpose.
You can check the python code from the transformers pipelines. https://github.com/huggingface/transformers/blob/19dabe96362803fb0a9ae7073d03533966598b17/src/transformers/pipelines/text_generation.py#L55

image

@Blarc Blarc closed this as completed in 23e2195 Dec 1, 2024
@danny-su
Copy link
Author

danny-su commented Dec 2, 2024

@Blarc It seems not to work as expected.
image
image

@Blarc Blarc reopened this Dec 2, 2024
@Blarc
Copy link
Owner

Blarc commented Dec 6, 2024

@danny-su That is a bit odd, since it works fine for me. Does the generated message contain the whole prompt or only a part?

@danny-su
Copy link
Author

danny-su commented Dec 9, 2024

@Blarc It only contains part of the prompt.
PixPin_2024-12-09_19-21-52

@danny-su
Copy link
Author

danny-su commented Dec 9, 2024

@Blarc, I got the connection time-out error when using Llama 3.3.
PixPin_2024-12-09_19-30-13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants