Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into DAN
Browse files Browse the repository at this point in the history
  • Loading branch information
Eaalghamdi committed Nov 21, 2024
2 parents 3bf4745 + e599eb0 commit 6841060
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
7 changes: 7 additions & 0 deletions garak/generators/huggingface.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ def _load_client(self):

pipeline_kwargs = self._gather_hf_params(hf_constructor=pipeline)
self.generator = pipeline("text-generation", **pipeline_kwargs)
if self.generator.tokenizer is None:
# account for possible model without a stored tokenizer
from transformers import AutoTokenizer

self.generator.tokenizer = AutoTokenizer.from_pretrained(
pipeline_kwargs["model"]
)
if not hasattr(self, "deprefix_prompt"):
self.deprefix_prompt = self.name in models_to_deprefix
if _config.loaded:
Expand Down
14 changes: 7 additions & 7 deletions garak/resources/plugin_cache.json
Original file line number Diff line number Diff line change
Expand Up @@ -6139,7 +6139,7 @@
},
"parallel_capable": false,
"supports_multiple_generations": true,
"mod_time": "2024-11-18 18:23:48 +0000"
"mod_time": "2024-11-20 18:59:25 +0000"
},
"generators.huggingface.InferenceAPI": {
"description": "Get text generations from Hugging Face Inference API",
Expand All @@ -6164,7 +6164,7 @@
},
"parallel_capable": true,
"supports_multiple_generations": true,
"mod_time": "2024-11-18 18:23:48 +0000"
"mod_time": "2024-11-20 18:59:25 +0000"
},
"generators.huggingface.InferenceEndpoint": {
"description": "Interface for Hugging Face private endpoints",
Expand All @@ -6189,7 +6189,7 @@
},
"parallel_capable": true,
"supports_multiple_generations": false,
"mod_time": "2024-11-18 18:23:48 +0000"
"mod_time": "2024-11-20 18:59:25 +0000"
},
"generators.huggingface.LLaVA": {
"description": "Get LLaVA ([ text + image ] -> text) generations",
Expand Down Expand Up @@ -6217,7 +6217,7 @@
},
"parallel_capable": false,
"supports_multiple_generations": false,
"mod_time": "2024-11-18 18:23:48 +0000"
"mod_time": "2024-11-20 18:59:25 +0000"
},
"generators.huggingface.Model": {
"description": "Get text generations from a locally-run Hugging Face model",
Expand All @@ -6244,7 +6244,7 @@
},
"parallel_capable": false,
"supports_multiple_generations": true,
"mod_time": "2024-11-18 18:23:48 +0000"
"mod_time": "2024-11-20 18:59:25 +0000"
},
"generators.huggingface.OptimumPipeline": {
"description": "Get text generations from a locally-run Hugging Face pipeline using NVIDIA Optimum",
Expand All @@ -6271,7 +6271,7 @@
},
"parallel_capable": false,
"supports_multiple_generations": true,
"mod_time": "2024-11-18 18:23:48 +0000"
"mod_time": "2024-11-20 18:59:25 +0000"
},
"generators.huggingface.Pipeline": {
"description": "Get text generations from a locally-run Hugging Face pipeline",
Expand All @@ -6298,7 +6298,7 @@
},
"parallel_capable": false,
"supports_multiple_generations": true,
"mod_time": "2024-11-18 18:23:48 +0000"
"mod_time": "2024-11-20 18:59:25 +0000"
},
"generators.langchain.LangChainLLMGenerator": {
"description": "Class supporting LangChain LLM interfaces",
Expand Down

0 comments on commit 6841060

Please sign in to comment.