"tests/vscode:/vscode.git/clone" did not exist on "f20c8f5a1aba27f5972cad50516f18ba516e4d9e"
Unverified Commit f2ae05a5 authored by Lintang Sutawika's avatar Lintang Sutawika Committed by GitHub
Browse files

Merge pull request #616 from EleutherAI/patch-sort-descending

Sort descending as intended for `greedy_until`
parents 0dd45190 a6952a0b
...@@ -399,8 +399,15 @@ class BaseLM(LM): ...@@ -399,8 +399,15 @@ class BaseLM(LM):
res = [] res = []
def _collate(x): def _collate(x):
# the negative sign on len(toks) sorts descending - this has a few advantages:
# - time estimates will always be over not underestimates, which is more useful for planning
# - to know the size of a batch when going through the list, you know the first one is always the batch
# padded context length. this is useful to simplify the batching logic and more importantly to make
# automatic adaptive batches much much easier to implement
# - any OOMs will happen right away rather than near the end
toks = self.tok_encode(x[0]) toks = self.tok_encode(x[0])
return len(toks), x[0] return -len(toks), x[0]
re_ord = utils.Reorderer(requests, _collate) re_ord = utils.Reorderer(requests, _collate)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment