Spaces:
Paused
Paused
update
Browse files
examples/api_eval/eval_gemini_google.py
CHANGED
|
@@ -3,8 +3,12 @@
|
|
| 3 |
import argparse
|
| 4 |
import json
|
| 5 |
import os
|
|
|
|
| 6 |
import time
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
from google import genai
|
| 9 |
from google.genai import types
|
| 10 |
|
|
@@ -122,6 +126,7 @@ Your output is:
|
|
| 122 |
config=generate_content_config,
|
| 123 |
)
|
| 124 |
time_cost = time.time() - time_begin
|
|
|
|
| 125 |
try:
|
| 126 |
prediction = response.candidates[0].content.parts[0].text
|
| 127 |
except TypeError:
|
|
@@ -147,7 +152,7 @@ Your output is:
|
|
| 147 |
row_ = json.dumps(row_, ensure_ascii=False)
|
| 148 |
fout.write(f"{row_}\n")
|
| 149 |
|
| 150 |
-
print(f"score: {score}")
|
| 151 |
|
| 152 |
return
|
| 153 |
|
|
|
|
| 3 |
import argparse
|
| 4 |
import json
|
| 5 |
import os
|
| 6 |
+
import sys
|
| 7 |
import time
|
| 8 |
|
| 9 |
+
pwd = os.path.abspath(os.path.dirname(__file__))
|
| 10 |
+
sys.path.append(os.path.join(pwd, "../../"))
|
| 11 |
+
|
| 12 |
from google import genai
|
| 13 |
from google.genai import types
|
| 14 |
|
|
|
|
| 126 |
config=generate_content_config,
|
| 127 |
)
|
| 128 |
time_cost = time.time() - time_begin
|
| 129 |
+
print(time_cost)
|
| 130 |
try:
|
| 131 |
prediction = response.candidates[0].content.parts[0].text
|
| 132 |
except TypeError:
|
|
|
|
| 152 |
row_ = json.dumps(row_, ensure_ascii=False)
|
| 153 |
fout.write(f"{row_}\n")
|
| 154 |
|
| 155 |
+
# print(f"score: {score}")
|
| 156 |
|
| 157 |
return
|
| 158 |
|
examples/api_eval/eval_openai.py
CHANGED
|
@@ -3,8 +3,12 @@
|
|
| 3 |
import argparse
|
| 4 |
import json
|
| 5 |
import os
|
|
|
|
| 6 |
import time
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
import openai
|
| 9 |
from openai import AzureOpenAI
|
| 10 |
|
|
@@ -118,6 +122,7 @@ Your output is:
|
|
| 118 |
# }
|
| 119 |
)
|
| 120 |
time_cost = time.time() - time_begin
|
|
|
|
| 121 |
except openai.BadRequestError as e:
|
| 122 |
print(f"request failed, error type: {type(e)}, error text: {str(e)}")
|
| 123 |
continue
|
|
@@ -145,7 +150,7 @@ Your output is:
|
|
| 145 |
row_ = json.dumps(row_, ensure_ascii=False)
|
| 146 |
fout.write(f"{row_}\n")
|
| 147 |
|
| 148 |
-
print(f"score: {score}")
|
| 149 |
|
| 150 |
return
|
| 151 |
|
|
|
|
| 3 |
import argparse
|
| 4 |
import json
|
| 5 |
import os
|
| 6 |
+
import sys
|
| 7 |
import time
|
| 8 |
|
| 9 |
+
pwd = os.path.abspath(os.path.dirname(__file__))
|
| 10 |
+
sys.path.append(os.path.join(pwd, "../../"))
|
| 11 |
+
|
| 12 |
import openai
|
| 13 |
from openai import AzureOpenAI
|
| 14 |
|
|
|
|
| 122 |
# }
|
| 123 |
)
|
| 124 |
time_cost = time.time() - time_begin
|
| 125 |
+
print(time_cost)
|
| 126 |
except openai.BadRequestError as e:
|
| 127 |
print(f"request failed, error type: {type(e)}, error text: {str(e)}")
|
| 128 |
continue
|
|
|
|
| 150 |
row_ = json.dumps(row_, ensure_ascii=False)
|
| 151 |
fout.write(f"{row_}\n")
|
| 152 |
|
| 153 |
+
# print(f"score: {score}")
|
| 154 |
|
| 155 |
return
|
| 156 |
|