Update chatbot.py
Browse files- chatbot.py +15 -2
chatbot.py
CHANGED
@@ -51,7 +51,20 @@ def load_pipeline():
|
|
51 |
max_tokens = 252,top_k = 30, early_stopping=True,
|
52 |
temperature = 0.1,repetition_penalty = 1.03)
|
53 |
|
54 |
-
llm = HuggingFacePipeline(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
return llm
|
56 |
|
57 |
# def generate_from_pipeline(text, pipe):
|
@@ -73,5 +86,5 @@ def demo_chain(input_text, memory):
|
|
73 |
memory=memory
|
74 |
)
|
75 |
|
76 |
-
chat_reply = conversation.
|
77 |
return chat_reply
|
|
|
51 |
max_tokens = 252,top_k = 30, early_stopping=True,
|
52 |
temperature = 0.1,repetition_penalty = 1.03)
|
53 |
|
54 |
+
llm = HuggingFacePipeline.from_model_id(
|
55 |
+
model_id=my_model_id,
|
56 |
+
task="text-generation",
|
57 |
+
model_kwargs={"trust_remote_code": True},
|
58 |
+
pipeline_kwargs={
|
59 |
+
"model": model,
|
60 |
+
"tokenizer": tokenizer,
|
61 |
+
"device_map": "auto",
|
62 |
+
"max_new_tokens": 512,
|
63 |
+
"temperature": 0.3,
|
64 |
+
"top_p": 0.85,
|
65 |
+
"repetition_penalty": 1.03,
|
66 |
+
},
|
67 |
+
)
|
68 |
return llm
|
69 |
|
70 |
# def generate_from_pipeline(text, pipe):
|
|
|
86 |
memory=memory
|
87 |
)
|
88 |
|
89 |
+
chat_reply = conversation.run(input=input_text)
|
90 |
return chat_reply
|