Skip to content

Commit

Permalink
ensure queries always multiple of 128 (#4)
Browse files Browse the repository at this point in the history
* ensure queries always multiple of 128

* upgrade artifacts

* fix
  • Loading branch information
epwalsh authored Feb 10, 2025
1 parent d1b5573 commit 6761cd1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
- name: Upload package distribution files
if: matrix.task.name == 'Build'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: package
path: dist
Expand Down Expand Up @@ -110,7 +110,7 @@ jobs:
echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Download package distribution files
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: package
path: dist
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

### Fixed

- Ensure queries are always a multiple of 128.

## [v0.6.0](https://github.com/allenai/OLMo-in-loop-evals/releases/tag/v0.6.0) - 2024-12-19

## [v0.5.0](https://github.com/allenai/OLMo-in-loop-evals/releases/tag/v0.5.0) - 2024-12-18
Expand Down
9 changes: 9 additions & 0 deletions src/olmo_eval/tasks.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import abc
import logging
import math
import re
from typing import Any, Dict, List, Optional, Sequence, Type, Union, cast

Expand Down Expand Up @@ -157,6 +158,9 @@ def max_sequence_length(self) -> int:
for sample in self.samples:
if len(sample["query"]) > max_seq_len:
max_seq_len = len(sample["query"])
# Pad to multiple of 128 for efficiency.
# TODO (epwalsh): make that configurable
max_seq_len = 128 * math.ceil(max_seq_len / 128)
self._max_sequence_length = max_seq_len
return self._max_sequence_length

Expand All @@ -181,6 +185,11 @@ def collate_fn(self, data):
if len(sample["dc_query"]) > max_dc_query_len:
max_dc_query_len = len(sample["dc_query"])

# Pad to multiple of 128 for efficiency.
# TODO (epwalsh): make that configurable
max_query_len = 128 * math.ceil(max_query_len / 128)
assert max_query_len <= self.max_sequence_length

doc_ids = []
cont_ids = []
ctxs = []
Expand Down

0 comments on commit 6761cd1

Please sign in to comment.