Skip to content

Commit

Permalink
Merge pull request #5 from ruivieira/release-0.4.5
Browse files Browse the repository at this point in the history
fix: cherry-pick TLS validation skip and Watsonx support from main into release-0.4.5
  • Loading branch information
ruivieira authored Nov 5, 2024
2 parents 1340416 + deea65f commit 6b8f30d
Show file tree
Hide file tree
Showing 5 changed files with 424 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
1 change: 1 addition & 0 deletions lm_eval/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
gguf,
hf_vlms,
huggingface,
ibm_watsonx_ai,
mamba_lm,
nemo_lm,
neuralmagic,
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
Loading

0 comments on commit 6b8f30d

Please sign in to comment.