(x)
| 273 | res = [] |
| 274 | |
| 275 | def _collate(x): |
| 276 | # the negative sign on len(toks) sorts descending - this has a few advantages: |
| 277 | # - time estimates will always be over not underestimates, which is more useful for planning |
| 278 | # - to know the size of a batch when going through the list, you know the first one is always the batch |
| 279 | # padded context length. this is useful to simplify the batching logic and more importantly to make |
| 280 | # automatic adaptive batches much much easier to implement |
| 281 | # - any OOMs will happen right away rather than near the end |
| 282 | |
| 283 | toks = x[1] + x[2] |
| 284 | return -len(toks), tuple(toks) |
| 285 | |
| 286 | re_ord = utils.Reorderer(requests, _collate) |
| 287 |
nothing calls this directly
no test coverage detected