Spaces:
Running
on
Zero
Running
on
Zero
liujie31
commited on
Commit
·
45fa259
1
Parent(s):
12805fd
update model count and sample func
Browse files- app.py +10 -7
- model_call_counter.txt +1 -1
app.py
CHANGED
@@ -63,13 +63,16 @@ def sample_prompt(lora_model):
|
|
63 |
try:
|
64 |
with open(file_path, 'r') as file:
|
65 |
prompts = file.readlines()
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
|
|
|
|
|
|
73 |
except FileNotFoundError:
|
74 |
return "Prompt file not found."
|
75 |
return ""
|
|
|
63 |
try:
|
64 |
with open(file_path, 'r') as file:
|
65 |
prompts = file.readlines()
|
66 |
+
if lora_model=='GenEval':
|
67 |
+
total_lines = len(prompts)
|
68 |
+
if total_lines > 0:
|
69 |
+
weights = [1/(i+1) for i in range(total_lines)]
|
70 |
+
sum_weights = sum(weights)
|
71 |
+
normalized_weights = [w/sum_weights for w in weights]
|
72 |
+
return random.choices(prompts, weights=normalized_weights, k=1)[0].strip()
|
73 |
+
return "No prompts found in file."
|
74 |
+
else:
|
75 |
+
return random.choice(prompts).strip()
|
76 |
except FileNotFoundError:
|
77 |
return "Prompt file not found."
|
78 |
return ""
|
model_call_counter.txt
CHANGED
@@ -1 +1 @@
|
|
1 |
-
|
|
|
1 |
+
190
|