Skip to content

Commit 42a94c5

Browse files
authored
Merge pull request #4 from shlomihod/adaptive-offset-header-test
Adjust offset to the size of few shot datasets
2 parents 2e96e51 + 3affa19 commit 42a94c5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tabmemcheck/functions.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -468,10 +468,12 @@ def header_test(
468468
)
469469
prefixes = [data[:offset]]
470470
suffixes = [data[offset : offset + completion_length]]
471-
few_shot = [
472-
([fs_data[:offset]], [fs_data[offset : offset + completion_length]])
473-
for fs_data in few_shot_data
474-
]
471+
472+
few_shot = []
473+
for fs_data in few_shot_data:
474+
fs_offset = min(offset, len(fs_data) // 2)
475+
few_shot.append(([fs_data[:fs_offset]],
476+
[fs_data[fs_offset : fs_offset + completion_length]]))
475477

476478
# chat mode: use few-shot examples
477479
if llm.chat_mode:

0 commit comments

Comments
 (0)