From 6c909ef19dd17ec3c03ea38c411309ea7ed54273 Mon Sep 17 00:00:00 2001 From: Jael Gu Date: Fri, 28 Jul 2023 16:49:27 +0800 Subject: [PATCH] Update readme Signed-off-by: Jael Gu --- README.md | 6 +++--- __init__.py | 2 +- llama2.py | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index da6af99..46bd385 100644 --- a/README.md +++ b/README.md @@ -59,9 +59,9 @@ p = ( pipe.input('question', 'docs', 'history') .map(('question', 'docs', 'history'), 'prompt', - ops.prompt.template(temp, ['question', 'context'], sys_message)) + ops.prompt.template(temp, ['question', 'context'], system_msg)) .map('prompt', 'answer', - ops.LLM.Llama_2(max_tokens=200)) + ops.LLM.Llama_2(temperature=0)) .output('answer') ) @@ -72,7 +72,7 @@ print(q1, ans1) history.append((q1, ans1)) docs.append('Towhee is a cutting-edge framework designed to streamline the processing of unstructured data through the use of Large Language Model (LLM) based pipeline orchestration.') -ans2 = p(q2, docs, history) +ans2 = p(q2, docs, history).get()[0] print(q2, ans2) ``` diff --git a/__init__.py b/__init__.py index 38e9485..99527e3 100644 --- a/__init__.py +++ b/__init__.py @@ -1,5 +1,5 @@ from .llama2 import LlamaCpp -def llama_2(*args, **kwargs): +def Llama_2(*args, **kwargs): return LlamaCpp(*args, **kwargs) diff --git a/llama2.py b/llama2.py index 86db3a0..a00bff6 100644 --- a/llama2.py +++ b/llama2.py @@ -39,7 +39,6 @@ class LlamaCpp(PyOperator): self.model_path = model_name_or_file assert os.path.isfile(self.model_path), f'Invalid model path: {self.model_path}' - print(111, self.model_path) self.model = Llama(model_path=self.model_path) def __call__(self, messages: List[dict]): @@ -52,7 +51,7 @@ class LlamaCpp(PyOperator): assert isinstance(messages, list), \ 'Inputs must be a list of dictionaries with keys from ["system", "question", "answer"].' prompt = '' - question = messages.pop[-1] + question = messages.pop(-1) assert len(question) == 1 and 'question' in question.keys() question = question['question'] for m in messages: