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

feat: hf inference support for gated repos #7598

Merged
merged 4 commits into from
Apr 29, 2024

Conversation

tstadel
Copy link
Member

@tstadel tstadel commented Apr 25, 2024

Related Issues

  • this allows us to use meta-llama/Meta-Llama-3-8B-Instruct via HF inference API

Proposed Changes:

  • pass hf token to DefaultPromptHandler for tokenizer
  • chore: add stop param to HFInferenceInvocationLayer (for usage via model_kwargs)

How did you test it?

  • ran locally, e.g.
    pn = PromptNode(
        model_name_or_path="meta-llama/Meta-Llama-3-8B-Instruct", 
        api_key="TOKEN",
        use_auth_token="TOKEN",
        model_kwargs={
            "stop": ["<|end_of_text|>", "<|eot_id|>"],
        }
    )
    pn("What is the capital of Germany?")

Notes for the reviewer

Checklist

@tstadel tstadel requested review from a team as code owners April 25, 2024 17:13
@tstadel tstadel requested review from dfokina and julian-risch and removed request for a team April 25, 2024 17:14
Copy link
Member

@julian-risch julian-risch left a comment

Choose a reason for hiding this comment

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

Looks good to me! 👍 Instead of just token, I'd find use_auth_token more consistent with the setting in PromptNode and in HFLocalInvocationLayer https://docs.haystack.deepset.ai/v1.26-unstable/reference/invocation-layers-api#hflocalinvocationlayer__init__

@tstadel
Copy link
Member Author

tstadel commented Apr 26, 2024

Looks good to me! 👍 Instead of just token, I'd find use_auth_token more consistent with the setting in PromptNode and in HFLocalInvocationLayer https://docs.haystack.deepset.ai/v1.26-unstable/reference/invocation-layers-api#hflocalinvocationlayer__init__

Ok, it's a bit weird in general how we use use_auth_token and api_key for HF throughout invocation layers. Would you then also rather take the use_auth_token param instead of api_key. Both are expected to be a HF token in this case.

@tstadel tstadel merged commit 3c2a4fe into v1.x Apr 29, 2024
53 checks passed
@tstadel tstadel deleted the feat/hf_inference_support_for_gated_repos branch April 29, 2024 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants