haystack icon indicating copy to clipboard operation
haystack copied to clipboard

feat: hf inference support for gated repos

Open tstadel opened this issue 10 months ago • 1 comments

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

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",
    )
    pn("What is the capital of Germany?")
    

Notes for the reviewer

Checklist

tstadel avatar Apr 25 '24 17:04 tstadel

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 avatar Apr 26 '24 07:04 tstadel