Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
evoprompt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Grießhaber Daniel
evoprompt
Commits
fb5630bc
Commit
fb5630bc
authored
1 year ago
by
Max Kimmich
Browse files
Options
Downloads
Patches
Plain Diff
Fix evolutions of current iteration not being accumulated
parent
4ecbf231
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
main.py
+4
-3
4 additions, 3 deletions
main.py
with
4 additions
and
3 deletions
main.py
+
4
−
3
View file @
fb5630bc
...
...
@@ -250,9 +250,11 @@ def run_episode(evo_alg_str: str):
if
evo_alg_str
==
"
de
"
:
# DE needs best prompt for evolution
best_prompt_current_evolution
=
max
(
range
(
N
),
key
=
lambda
i
:
S
[
t
-
1
][
i
])
# keep track of evolutions of current iteration
new_evolutions
=
[]
new_evolutions_scores
=
[]
for
i
in
trange
(
N
,
desc
=
"
N
"
,
leave
=
False
):
new_evolutions
=
[]
new_evolutions_scores
=
[]
# for both GA and DE we start with two parent prompts
pr1
,
pr2
=
selection
(
P
[
t
-
1
],
S
[
t
-
1
])
...
...
@@ -302,7 +304,6 @@ def run_episode(evo_alg_str: str):
# p∗ ← argmaxp∈PT f(p, D)
p
=
max
(
range
(
N
),
key
=
lambda
i
:
S
[
T
][
i
])
logger
.
info
(
f
"
Best prompt:
{
P
[
T
][
p
]
}
"
)
print
(
P
[
p
])
# We pick the prompt with the highest score on the development set and report its score on the testset.
test_D
=
load_dataset
(
"
SetFit/sst2
"
,
split
=
"
test
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment