Skip to content

Cannot access gated repositories in Perplexity measurements module #680

@itz-Amethyst

Description

@itz-Amethyst

Since accessing gated models requires authentication by passing either a hf_token or using the login() method.

The measurements/perplexity/README.md file doesn't mention how to authenticate for gated models, and I've tried passing the token via model configuration parameters directly to the compute() function. However, it seems there's no mechanism in place to capture **kwargs and pass them down to from_pretrained() within the current implementation:

def _compute(
self, data, model_id, batch_size: int = 16, add_start_token: bool = True, device=None, max_length=None
):

output = self._compute(**inputs, **compute_kwargs)

An easy way would be just use login function before calling compute function

from huggingface_hub import login

hf_token = os.environ["HF_TOKEN"]
model_id = "meta-llama/Meta-Llama-3.1-8B-Instruct"

perplexity = load("perplexity", module_type="measurement")

login(token = hf_token)

results = perplexity.compute(
    data=[first_question, second_question],
    model_id=model_id,
)

But this doesn't offer any flexibility for passing additional model parameters to from_pretrained().
It would be helpful if calling compute() could accept and propagate such kwargs to model.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions