Skip to content

Commit

Permalink
Merge branch 'llava_dev' of https://github.com/DavidLee528/garak into…
Browse files Browse the repository at this point in the history
… llava_dev
  • Loading branch information
DavidLee528 committed May 1, 2024
2 parents 6784255 + cb8d917 commit d3569c6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
1 change: 0 additions & 1 deletion garak/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import sys

sys.path.append("/home/sda/tianhaoli/garak")
from garak import cli


Expand Down
10 changes: 2 additions & 8 deletions garak/generators/huggingface.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ def __init__(self, name, do_sample=True, generations=10, device=0):
model=name,
do_sample=do_sample,
device=device,
proxy={'http': 'http://127.0.0.1:7890/', 'https': 'http://127.0.0.1:7890/'}
)
self.deprefix_prompt = name in models_to_deprefix
if _config.loaded:
Expand Down Expand Up @@ -306,7 +305,6 @@ def _call_model(self, prompt: str, generations_this_call: int = 1) -> List[str]:
headers=self.headers,
json=payload,
timeout=(20, 90), # (connect, read)
proxies={'http': 'http://127.0.0.1:7890/', 'https': 'http://127.0.0.1:7890/'}
)

if req_response.status_code == 503:
Expand Down Expand Up @@ -536,18 +534,14 @@ class LLaVA(Generator):
]

def __init__(self, name="", generations=10):
proxies = {
'http': 'http://127.0.0.1:7890',
'https': 'http://127.0.0.1:7890'
}
if name not in self.supported_models:
raise ValueError(
f"Invalid modal name {name}, current support: {self.supported_models}."
)
self.processor = LlavaNextProcessor.from_pretrained(name, proxies=proxies)
self.processor = LlavaNextProcessor.from_pretrained(name)
self.model = LlavaNextForConditionalGeneration.from_pretrained(name,
torch_dtype=torch.float16,
low_cpu_mem_usage=True, proxies=proxies)
low_cpu_mem_usage=True)
if torch.cuda.is_available():
self.model.to("cuda:0")
else:
Expand Down

0 comments on commit d3569c6

Please sign in to comment.