Unverified Commit 2d433a4a authored by Hailey Schoelkopf's avatar Hailey Schoelkopf Committed by GitHub
Browse files

Update and rename ggml.py to gguf.py

parent 32f2bcf3
...@@ -31,7 +31,7 @@ def get_result(logprobs, context_lenght): ...@@ -31,7 +31,7 @@ def get_result(logprobs, context_lenght):
return continuation_logprobs, is_greedy return continuation_logprobs, is_greedy
class GGMLLM(BaseLM): class GGUFLM(BaseLM):
def __init__(self, base_url, truncate=False): def __init__(self, base_url, truncate=False):
super().__init__() super().__init__()
self.base_url = base_url self.base_url = base_url
...@@ -42,7 +42,7 @@ class GGMLLM(BaseLM): ...@@ -42,7 +42,7 @@ class GGMLLM(BaseLM):
self.max_length = 1024 self.max_length = 1024
self.vocab_size = self.tokenizer.vocab_size self.vocab_size = self.tokenizer.vocab_size
def ggml_completion(self, context, continuation=None, stop=None, retries=3, delay=5, **kwargs): def gguf_completion(self, context, continuation=None, stop=None, retries=3, delay=5, **kwargs):
for _ in range(retries): for _ in range(retries):
try: try:
prompt = context prompt = context
...@@ -67,7 +67,7 @@ class GGMLLM(BaseLM): ...@@ -67,7 +67,7 @@ class GGMLLM(BaseLM):
return [] return []
res = [] res = []
for context, continuation in tqdm(requests): for context, continuation in tqdm(requests):
response = self.ggml_completion(context=context, continuation=continuation) response = self.gguf_completion(context=context, continuation=continuation)
if response and "choices" in response and response["choices"]: if response and "choices" in response and response["choices"]:
choice = response["choices"][0] choice = response["choices"][0]
logprobs = choice.get("logprobs") logprobs = choice.get("logprobs")
...@@ -90,7 +90,7 @@ class GGMLLM(BaseLM): ...@@ -90,7 +90,7 @@ class GGMLLM(BaseLM):
inp = request[0] inp = request[0]
request_args = request[1] request_args = request[1]
until = request_args["until"] until = request_args["until"]
response = self.ggml_completion(context=inp, stop=until) response = self.gguf_completion(context=inp, stop=until)
if response and "choices" in response and response["choices"]: if response and "choices" in response and response["choices"]:
choice = response["choices"][0] choice = response["choices"][0]
if "text" in choice: if "text" in choice:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment