nestole commited on
Commit
f745570
·
verified ·
1 Parent(s): 3e8c5ce

Update run.py

Browse files
Files changed (1) hide show
  1. run.py +5 -5
run.py CHANGED
@@ -120,7 +120,7 @@ def format_prompt(message):
120
  def responsecritical(
121
  prompt, temperature=0.9, max_new_tokens=500, top_p=0.95, repetition_penalty=1.0,
122
  ):
123
- temperature = float(0.9)
124
  if temperature < 1e-2: temperature = 1e-2
125
  top_p = float(top_p)
126
  generate_kwargs = dict(
@@ -135,10 +135,10 @@ def responsecritical(
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
- output = ""
139
- for response in stream:
140
- output += response.token.text
141
- sentence_lower = output.lower()
142
  print("Done Critcial")
143
  # Check if the word 'nein' is in the sentence
144
  if 'nein' in sentence_lower:
 
120
  def responsecritical(
121
  prompt, temperature=0.9, max_new_tokens=500, top_p=0.95, repetition_penalty=1.0,
122
  ):
123
+ temperature = float(temperature)
124
  if temperature < 1e-2: temperature = 1e-2
125
  top_p = float(top_p)
126
  generate_kwargs = dict(
 
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
+ for responsec in stream:
140
+ outputc += responsec.token.text
141
+ sentence_lower = outputc.lower()
142
  print("Done Critcial")
143
  # Check if the word 'nein' is in the sentence
144
  if 'nein' in sentence_lower: