-
Notifications
You must be signed in to change notification settings - Fork 304
Description
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:
evaluate/measurements/perplexity/perplexity.py
Lines 104 to 106 in 5aa3982
| def _compute( | |
| self, data, model_id, batch_size: int = 16, add_start_token: bool = True, device=None, max_length=None | |
| ): |
evaluate/src/evaluate/module.py
Line 467 in 5aa3982
| 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.