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

[FIX] fix hf output bug (current output contain user prompt which cause logical error in entity extraction phase) #138

Merged
merged 2 commits into from
Oct 26, 2024

Conversation

tackhwa
Copy link
Contributor

@tackhwa tackhwa commented Oct 25, 2024

  • the current response_text in hf_model_if_cache will contain user prompt as shown as follows:
    image

  • even though the response_text is being stripped in operate.py which make the final response look like normally, but in the process of creating the knowledge graph and vector databse (entity extraction phase), the user prompt is not strip, which will result the prompt PROMPTS["entity_extraction"] in prompt.py will also consider as assitant response as well and causes the entity in example prompt is being extracted, but these entity is not actually in the text file (pure text database), instead, it just an example entity.

  • what does thir pr do: remove user prompt in response as shown as follows:
    8933b3a26fef0bed0bab6ae8ad2c5ef

@tackhwa tackhwa changed the title [FIX] fix hf output bug (output contain user prompt) [FIX] fix hf output bug (current output contain user prompt which cause logical error in entity extraction phase) Oct 26, 2024
@LarFii LarFii merged commit fd68757 into HKUDS:main Oct 26, 2024
@LarFii
Copy link
Collaborator

LarFii commented Oct 26, 2024

This might only solve the issue for certain models, as each model’s output logic can vary quite a bit. : (

@tackhwa
Copy link
Contributor Author

tackhwa commented Oct 26, 2024

This might only solve the issue for certain models, as each model’s output logic can vary quite a bit. : (

ya, but at least i tested with few popular model, qwen, llama-3.2, internlm. this code does solve the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants