Spaces:
Sleeping
Sleeping
Commit
·
dcbdce4
1
Parent(s):
ad27ecb
update scripts
Browse files
src/backend/model_operations.py
CHANGED
|
@@ -118,7 +118,7 @@ class SummaryGenerator:
|
|
| 118 |
"""Generate summaries for a given DataFrame of source docs.
|
| 119 |
修改这里拉取模型生成结果
|
| 120 |
Args:
|
| 121 |
-
|
| 122 |
|
| 123 |
Returns:
|
| 124 |
summaries_df (DataFrame): Generated summaries by the model.
|
|
@@ -192,7 +192,7 @@ class SummaryGenerator:
|
|
| 192 |
while True:
|
| 193 |
try:
|
| 194 |
'''调用'''
|
| 195 |
-
print(ID,'-',ii)
|
| 196 |
|
| 197 |
_response = self.generate_summary(system_prompt, _user_prompt)
|
| 198 |
# print(f"Finish index {index}")
|
|
@@ -222,10 +222,10 @@ class SummaryGenerator:
|
|
| 222 |
try:
|
| 223 |
_response = self.generate_summary(system_prompt, _user_prompt)
|
| 224 |
break
|
| 225 |
-
except Exception as
|
| 226 |
-
exceptions.append(
|
| 227 |
retries += 1
|
| 228 |
-
print(f"Retry {retries}/{max_retries} failed at index {i}: {
|
| 229 |
if retries >= max_retries:
|
| 230 |
exit_outer_loop = True
|
| 231 |
break
|
|
@@ -466,9 +466,9 @@ class SummaryGenerator:
|
|
| 466 |
time.sleep(1) # Optional: Add a small delay before retrying
|
| 467 |
|
| 468 |
return result
|
| 469 |
-
except Exception as
|
| 470 |
print(f"Error with TOKEN1: {envs.TOKEN1}")
|
| 471 |
-
raise
|
| 472 |
|
| 473 |
# except: # fail to call api. run it locally.
|
| 474 |
# self.tokenizer = AutoTokenizer.from_pretrained(self.model_id, trust_remote_code=True)
|
|
|
|
| 118 |
"""Generate summaries for a given DataFrame of source docs.
|
| 119 |
修改这里拉取模型生成结果
|
| 120 |
Args:
|
| 121 |
+
dataset (DataFrame): DataFrame containing source docs.
|
| 122 |
|
| 123 |
Returns:
|
| 124 |
summaries_df (DataFrame): Generated summaries by the model.
|
|
|
|
| 192 |
while True:
|
| 193 |
try:
|
| 194 |
'''调用'''
|
| 195 |
+
print(ID,'-',j,'-',ii)
|
| 196 |
|
| 197 |
_response = self.generate_summary(system_prompt, _user_prompt)
|
| 198 |
# print(f"Finish index {index}")
|
|
|
|
| 222 |
try:
|
| 223 |
_response = self.generate_summary(system_prompt, _user_prompt)
|
| 224 |
break
|
| 225 |
+
except Exception as ee:
|
| 226 |
+
exceptions.append(ee)
|
| 227 |
retries += 1
|
| 228 |
+
print(f"Retry {retries}/{max_retries} failed at index {i}: {ee}")
|
| 229 |
if retries >= max_retries:
|
| 230 |
exit_outer_loop = True
|
| 231 |
break
|
|
|
|
| 466 |
time.sleep(1) # Optional: Add a small delay before retrying
|
| 467 |
|
| 468 |
return result
|
| 469 |
+
except Exception as ee:
|
| 470 |
print(f"Error with TOKEN1: {envs.TOKEN1}")
|
| 471 |
+
raise ee
|
| 472 |
|
| 473 |
# except: # fail to call api. run it locally.
|
| 474 |
# self.tokenizer = AutoTokenizer.from_pretrained(self.model_id, trust_remote_code=True)
|