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 request settings and stop words in HF provider #14504

Merged
merged 1 commit into from
Nov 26, 2024
Merged

Conversation

JonasHelming
Copy link
Contributor

@JonasHelming JonasHelming commented Nov 23, 2024

fixed #14503

What it does

  • Huggingface provider respects request settings
  • Added Huggingface default settings (the stop words are very common)
  • Remove all configured stop words from response

How to test

  • Set up a HuggingFace Model
  • e.g.: "Qwen/Qwen2.5-Coder-32B-Instruct"
  • Configure it for the universal chat agent
  • Ask it a question
  • Observe that always end with '<|im_end|>'
  • Change HF defaults in the model:
   protected getDefaultSettings(): Record<string, any> {
        return {
            max_new_tokens: 2024,
            stop: ['<|endoftext|>', '<eos>', '<|im_end|>']
        };
    }
  • Observe that it does not end with '<|im_end|>' anymore
  • Turn streaming of in the HuggingFaceModel
  • Same test
  • Turn streaming on in the HuggingFaceModel
  • Remove default override
  • Add settings to the universal-chat-agent
   protected override getLlmSettings(): { [key: string]: unknown } | undefined {
      return {
         max_new_tokens: 2024,
         stop: ['<|im_end|>'],
      };
   }
   
  • Observe that it does not end with '<|im_end|>' anymore
  • and without streaming

Follow-ups

  • We must think about how we want to allow the user configure these settings (per model, per provider, per agent, per prompt?)
  • In particular for the stop words: As HuggingFace does not replace them, I think we should as a first step allow to configure stop words for HuggingFace Models only. This way HF gets even usable.
  • If we start to really use the settings, we need a compatibility check for all provider APIs. Most parameters are valid for all of them, but not all of them

Review checklist

Reminder for reviewers

fixed #14503

Signed-off-by: Jonas Helming <jhelming@eclipsesource.com>
@JonasHelming JonasHelming requested a review from sdirix November 23, 2024 11:54
@JonasHelming JonasHelming marked this pull request as draft November 23, 2024 20:35
@JonasHelming JonasHelming marked this pull request as ready for review November 23, 2024 22:18
Copy link
Member

@sdirix sdirix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me ❤️

@JonasHelming JonasHelming merged commit 55e29ed into master Nov 26, 2024
11 checks passed
@github-actions github-actions bot added this to the 1.56.0 milestone Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Request Settings in Huggingface Provider are broken
2 participants