MindLabUnimib commited on
Commit
2c04d38
·
verified ·
1 Parent(s): d504eb5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -82,12 +82,12 @@ def generate(submission: list[dict[str, str]], team_id: str) -> list[dict[str, s
82
 
83
  start = time.perf_counter()
84
  messages = [[{"role": "user", "content": prompt}] for prompt in prompts]
85
- outputs = model(messages, do_sample=False, temperature=None, max_new_tokens=256, repetition_penalty=1.1)
86
  responses = [output[0]["generated_text"][-1]["content"] for output in outputs]
87
  print(f"Generation: {(time.perf_counter() - start):.3f} s")
88
 
89
  start = time.perf_counter()
90
- predictions = classifier([{"text": p, "text_pair": r} for p, r in zip(prompts, responses)], top_k=None)
91
  print(f"Classifier: {(time.perf_counter() - start):.3f} s")
92
 
93
  scores = [p[unsafe_idx]["score"] for p in predictions]
 
82
 
83
  start = time.perf_counter()
84
  messages = [[{"role": "user", "content": prompt}] for prompt in prompts]
85
+ outputs = model(messages, do_sample=False, temperature=None, max_new_tokens=256, repetition_penalty=1.1, batch_size=25)
86
  responses = [output[0]["generated_text"][-1]["content"] for output in outputs]
87
  print(f"Generation: {(time.perf_counter() - start):.3f} s")
88
 
89
  start = time.perf_counter()
90
+ predictions = classifier([{"text": p, "text_pair": r} for p, r in zip(prompts, responses)], top_k=None, batch_size=25)
91
  print(f"Classifier: {(time.perf_counter() - start):.3f} s")
92
 
93
  scores = [p[unsafe_idx]["score"] for p in predictions]