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
9249cf32
Commit
9249cf32
authored
5 months ago
by
Max Kimmich
Browse files
Options
Downloads
Patches
Plain Diff
Update temperature for more creative generations
parent
2780fdcb
No related branches found
Branches containing commit
No related tags found
1 merge request
!7
Refactor tasks and models and fix format for various models
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
evoprompt/evolution/evolution.py
+3
-0
3 additions, 0 deletions
evoprompt/evolution/evolution.py
evoprompt/models.py
+8
-4
8 additions, 4 deletions
evoprompt/models.py
evoprompt/task/task.py
+1
-1
1 addition, 1 deletion
evoprompt/task/task.py
with
12 additions
and
5 deletions
evoprompt/evolution/evolution.py
+
3
−
0
View file @
9249cf32
...
...
@@ -249,6 +249,7 @@ class GeneticAlgorithm(EvolutionAlgorithm):
self
.
evolution_model
.
create_completion
(
system_message
=
SYSTEM_MESSAGE
,
prompt
=
filled_prompt
,
enforce_randomness
=
True
,
)
)
...
...
@@ -351,6 +352,7 @@ class DifferentialEvolution(EvolutionAlgorithm):
self
.
evolution_model
.
create_completion
(
system_message
=
SYSTEM_MESSAGE
,
prompt
=
filled_prompt
,
enforce_randomness
=
True
,
)
)
...
...
@@ -468,6 +470,7 @@ class DifferentialEvolutionWithCot(DifferentialEvolution):
prompt
=
filled_prompt
,
history
=
history
,
stop
=
"
</prompt>
"
if
idx
==
len
(
DE_COT_PROMPTS
)
-
1
else
None
,
enforce_randomness
=
True
,
)
)
logger
.
debug
(
...
...
This diff is collapsed.
Click to expand it.
evoprompt/models.py
+
8
−
4
View file @
9249cf32
...
...
@@ -275,7 +275,8 @@ class Llama(LLMModel):
"
max_tokens
"
:
max_tokens
,
}
if
enforce_randomness
:
model_call_kwargs
[
"
temperature
"
]
=
2.0
# same temperature as in evoprompt paper reference implementation
model_call_kwargs
[
"
temperature
"
]
=
0.5
model_call_kwargs
[
"
seed
"
]
=
random
.
randint
(
0
,
2
**
32
-
1
)
else
:
model_call_kwargs
[
"
temperature
"
]
=
0.0
...
...
@@ -398,7 +399,8 @@ class LlamaChat(ChatModel, Llama):
"
max_tokens
"
:
max_tokens
,
}
if
enforce_randomness
:
model_call_kwargs
[
"
temperature
"
]
=
2.0
# same temperature as in evoprompt paper reference implementation
model_call_kwargs
[
"
temperature
"
]
=
0.5
model_call_kwargs
[
"
seed
"
]
=
random
.
randint
(
0
,
2
**
32
-
1
)
else
:
model_call_kwargs
[
"
temperature
"
]
=
0.0
...
...
@@ -478,7 +480,8 @@ class HfChat(ChatModel, LLMModel):
"
max_length
"
:
max_tokens
if
max_tokens
is
not
None
else
2048
,
}
if
enforce_randomness
:
model_call_kwargs
[
"
temperature
"
]
=
2.0
# same temperature as in evoprompt paper reference implementation
model_call_kwargs
[
"
temperature
"
]
=
0.5
model_call_kwargs
[
"
do_sample
"
]
=
True
else
:
model_call_kwargs
[
"
do_sample
"
]
=
False
...
...
@@ -575,7 +578,8 @@ class OpenAIChat(ChatModel, LLMModel):
"
max_completion_tokens
"
:
max_tokens
if
max_tokens
is
not
None
else
1024
,
}
if
enforce_randomness
:
model_call_kwargs
[
"
temperature
"
]
=
2.0
# same temperature as in evoprompt paper reference implementation
model_call_kwargs
[
"
temperature
"
]
=
0.5
else
:
model_call_kwargs
[
"
temperature
"
]
=
0.0
...
...
This diff is collapsed.
Click to expand it.
evoprompt/task/task.py
+
1
−
1
View file @
9249cf32
...
...
@@ -415,7 +415,7 @@ class Task(metaclass=ABCMeta):
# we use cached completions to speed up the process although we loose the non-deterministic behavior of LMs, but we're ok with a single result
use_cache
=
True
,
# use less randomness, i.e., more certain outputs
temperature
=
0.0
,
enforce_randomness
=
False
,
)
if
not
self
.
use_grammar
:
...
...
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