Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
lm-evaluation-harness
Commits
691e0c0d
"docs/en_US/KubeflowMode.md" did not exist on "e31839cc4a212311cac677dfebd4526ea343e9be"
Commit
691e0c0d
authored
May 22, 2024
by
Konrad
Browse files
Adding a fewshot in a more readable way
parent
9bd948df
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
lm_eval/api/samplers.py
lm_eval/api/samplers.py
+1
-1
lm_eval/api/task.py
lm_eval/api/task.py
+4
-2
No files found.
lm_eval/api/samplers.py
View file @
691e0c0d
...
...
@@ -61,8 +61,8 @@ class ContextSampler:
doc
,
num_fewshot
,
fewshot_as_multiturn
:
bool
=
False
,
chat_history
:
list
=
[],
):
chat_history
=
[]
# draw an extra fewshot sample if using same split as evaluating on
n_samples
=
(
num_fewshot
+
1
...
...
lm_eval/api/task.py
View file @
691e0c0d
...
...
@@ -1043,8 +1043,10 @@ class ConfigurableTask(Task):
# if few-shot - append examples after the system prompt
if
num_fewshot
>
0
:
if
apply_chat_template
:
labeled_examples
=
self
.
sampler
.
get_chat_context
(
doc
,
num_fewshot
,
fewshot_as_multiturn
,
labeled_examples
labeled_examples
.
extend
(
self
.
sampler
.
get_chat_context
(
doc
,
num_fewshot
,
fewshot_as_multiturn
)
)
else
:
labeled_examples
+=
self
.
sampler
.
get_context
(
doc
,
num_fewshot
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment