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
62f4d663
Commit
62f4d663
authored
Jul 03, 2023
by
haileyschoelkopf
Browse files
add typehint
parent
b8154374
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
lm_eval/utils.py
lm_eval/utils.py
+6
-2
No files found.
lm_eval/utils.py
View file @
62f4d663
...
@@ -10,7 +10,7 @@ import collections
...
@@ -10,7 +10,7 @@ import collections
import
importlib.util
import
importlib.util
import
fnmatch
import
fnmatch
from
typing
import
List
,
Union
from
typing
import
List
,
Literal
,
Union
import
gc
import
gc
import
torch
import
torch
...
@@ -453,7 +453,11 @@ def create_iterator(raw_iterator, rank, world_size, limit=None):
...
@@ -453,7 +453,11 @@ def create_iterator(raw_iterator, rank, world_size, limit=None):
return
islice
(
raw_iterator
,
rank
,
limit
,
world_size
)
return
islice
(
raw_iterator
,
rank
,
limit
,
world_size
)
def
pad_and_concat
(
max_length
:
int
,
tensors
:
List
[
torch
.
Tensor
],
padding_side
=
"right"
):
def
pad_and_concat
(
max_length
:
int
,
tensors
:
List
[
torch
.
Tensor
],
padding_side
:
Literal
[
"right"
,
"left"
]
=
"right"
,
):
"""
"""
Method for padding a list of tensors given the maximum tensor
Method for padding a list of tensors given the maximum tensor
length in the batch. Used for batching inputs and continuations in
length in the batch. Used for batching inputs and continuations in
...
...
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