Skip to content

Commit

Permalink
Add verify_certificate argument to local-completion (#2440)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjmonson authored Oct 30, 2024
1 parent b40a20a commit 57272b6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/API_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ When initializing a `TemplateAPI` instance or a subclass, you can provide severa
- Custom token ID to use as a prefix for inputs.
- If not provided, uses the model's default BOS or EOS token (if `add_bos_token` is True).

- `verify_certificate` (bool, optional):
- Whether to validate the certificate of the API endpoint (if HTTPS).
- Default is True.


Example usage:

Expand Down
3 changes: 3 additions & 0 deletions lm_eval/models/api_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def __init__(
trust_remote_code: bool = False,
revision: Optional[str] = "main",
use_fast_tokenizer: bool = True,
verify_certificate: bool = True,
**kwargs,
) -> None:
super().__init__()
Expand Down Expand Up @@ -120,6 +121,7 @@ def __init__(
self.custom_prefix_token_id = custom_prefix_token_id
self.tokenized_requests = tokenized_requests
self.max_retries = int(max_retries)
self.verify_certificate = verify_certificate

eval_logger.info(f"Using tokenizer {self.tokenizer_backend}")
if self.tokenizer_backend is None:
Expand Down Expand Up @@ -342,6 +344,7 @@ def model_call(
**kwargs,
),
headers=self.header,
verify=self.verify_certificate,
)
if not response.ok:
eval_logger.warning(
Expand Down

0 comments on commit 57272b6

Please sign in to comment.