Update run.py
Browse files
run.py
CHANGED
@@ -118,34 +118,10 @@ def format_prompt(message):
|
|
118 |
return prompt
|
119 |
|
120 |
def responsecritical(
|
121 |
-
prompt
|
122 |
):
|
123 |
-
temperature = float(temperature)
|
124 |
-
if temperature < 1e-2: temperature = 1e-2
|
125 |
-
top_p = float(top_p)
|
126 |
-
generate_kwargs = dict(
|
127 |
-
temperature=temperature,
|
128 |
-
max_new_tokens=max_new_tokens,
|
129 |
-
top_p=top_p,
|
130 |
-
repetition_penalty=repetition_penalty,
|
131 |
-
do_sample=True,
|
132 |
-
seed=42,
|
133 |
-
)
|
134 |
-
|
135 |
-
system="Bitte evaluiere ob die Frage soziokulturell oder allgemein problematisch oder auch sensibel oder politisch ist. Antworte ausschließlich mit Ja wenn sie soziokulturell oder allgemein problematisch ist, ansonsten nur mit Nein. Erkläre deine Entscheidung nicht.\n\nUser-Anliegen:"
|
136 |
-
formatted_prompt = format_prompt(system+"\n"+prompt)
|
137 |
-
stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
138 |
-
outputc = ""
|
139 |
-
print(stream)
|
140 |
-
for responsec in stream:
|
141 |
-
outputc += responsec.token.text
|
142 |
-
sentence_lower = outputc.lower()
|
143 |
-
print("Done Critcial")
|
144 |
-
# Check if the word 'nein' is in the sentence
|
145 |
-
if 'nein' in sentence_lower:
|
146 |
return True
|
147 |
-
|
148 |
-
return False
|
149 |
|
150 |
def response(
|
151 |
prompt, temperature=0.9, max_new_tokens=500, top_p=0.95, repetition_penalty=1.0,
|
|
|
118 |
return prompt
|
119 |
|
120 |
def responsecritical(
|
121 |
+
prompt
|
122 |
):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
return True
|
124 |
+
|
|
|
125 |
|
126 |
def response(
|
127 |
prompt, temperature=0.9, max_new_tokens=500, top_p=0.95, repetition_penalty=1.0,
|