Spaces:
Sleeping
Sleeping
arjunanand13
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -97,17 +97,17 @@ class StopOnTokens(StoppingCriteria):
|
|
97 |
stopping_criteria = StoppingCriteriaList([StopOnTokens()])
|
98 |
|
99 |
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
#
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
|
112 |
llm = HuggingFacePipeline(pipeline=generate_text)
|
113 |
|
|
|
97 |
stopping_criteria = StoppingCriteriaList([StopOnTokens()])
|
98 |
|
99 |
|
100 |
+
generate_text = transformers.pipeline(
|
101 |
+
model=model,
|
102 |
+
tokenizer=tokenizer,
|
103 |
+
return_full_text=True, # langchain expects the full text
|
104 |
+
task='text-generation',
|
105 |
+
# we pass model parameters here too
|
106 |
+
stopping_criteria=stopping_criteria, # without this model rambles during chat
|
107 |
+
temperature=0.1, # 'randomness' of outputs, 0.0 is the min and 1.0 the max
|
108 |
+
max_new_tokens=512, # max number of tokens to generate in the output
|
109 |
+
repetition_penalty=1.1 # without this output begins repeating
|
110 |
+
)
|
111 |
|
112 |
llm = HuggingFacePipeline(pipeline=generate_text)
|
113 |
|