Spaces:
Running
Running
Fix sleep bug
Browse files
app.py
CHANGED
|
@@ -166,6 +166,7 @@ def grade(file_obj, progress=gr.Progress()):
|
|
| 166 |
grade_sample_run_complete = False
|
| 167 |
temperature = 0.0
|
| 168 |
|
|
|
|
| 169 |
while not grade_sample_run_complete:
|
| 170 |
try:
|
| 171 |
response = openai.ChatCompletion.create(
|
|
@@ -206,8 +207,15 @@ def grade(file_obj, progress=gr.Progress()):
|
|
| 206 |
grade_sample_run_complete = True
|
| 207 |
except:
|
| 208 |
# gpt4 may have token rate limit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 209 |
print("sleep 30s")
|
| 210 |
time.sleep(30)
|
|
|
|
| 211 |
|
| 212 |
if len(sample_grade['model']) >= j + 1:
|
| 213 |
sample_grade['model'][j] = response['model']
|
|
@@ -298,7 +306,7 @@ markdown = """
|
|
| 298 |
|
| 299 |
In this demo, we offer MM-Vet LLM-based (GPT-4) evaluator to grade open-ended outputs from your models.
|
| 300 |
|
| 301 |
-
Plese upload your json file of your model results containing
|
| 302 |
|
| 303 |
The grading may last 5 minutes. Sine we only support 1 queue, the grading time may be longer when you need to wait for other users' grading to finish.
|
| 304 |
|
|
|
|
| 166 |
grade_sample_run_complete = False
|
| 167 |
temperature = 0.0
|
| 168 |
|
| 169 |
+
num_sleep = 0
|
| 170 |
while not grade_sample_run_complete:
|
| 171 |
try:
|
| 172 |
response = openai.ChatCompletion.create(
|
|
|
|
| 207 |
grade_sample_run_complete = True
|
| 208 |
except:
|
| 209 |
# gpt4 may have token rate limit
|
| 210 |
+
num_sleep += 1
|
| 211 |
+
if num_sleep > 2:
|
| 212 |
+
score = 0.0
|
| 213 |
+
grade_sample_run_complete = True
|
| 214 |
+
num_sleep = 0
|
| 215 |
+
continue
|
| 216 |
print("sleep 30s")
|
| 217 |
time.sleep(30)
|
| 218 |
+
|
| 219 |
|
| 220 |
if len(sample_grade['model']) >= j + 1:
|
| 221 |
sample_grade['model'][j] = response['model']
|
|
|
|
| 306 |
|
| 307 |
In this demo, we offer MM-Vet LLM-based (GPT-4) evaluator to grade open-ended outputs from your models.
|
| 308 |
|
| 309 |
+
Plese upload your json file of your model results containing `{v1_0: ..., v1_1: ..., }`like [this json file](https://raw.githubusercontent.com/yuweihao/MM-Vet/main/results/llava_llama2_13b_chat.json).
|
| 310 |
|
| 311 |
The grading may last 5 minutes. Sine we only support 1 queue, the grading time may be longer when you need to wait for other users' grading to finish.
|
| 312 |
|