|
8 | 8 | from exllamav2.ext import exllamav2_ext as ext_c, none_tensor
|
9 | 9 | from concurrent.futures import ThreadPoolExecutor
|
10 | 10 |
|
| 11 | +from exllamav2.compat import pairwise |
11 | 12 | import torch
|
12 | 13 | import random
|
13 | 14 | import numpy as np
|
@@ -1331,7 +1332,7 @@ def __eq__(self, other):
|
1331 | 1332 | rotation = [r * self.page_size for r in rotation]
|
1332 | 1333 | for cache, buffer in zip(cache_tensors, defrag_buffers):
|
1333 | 1334 | buffer[:, :, :, :].copy_(cache[:, rotation[0] : rotation[0] + self.page_size, :, :])
|
1334 |
| - for a, b in itertools.pairwise(rotation): |
| 1335 | + for a, b in pairwise(rotation): |
1335 | 1336 | cache[:, a : a + self.page_size, :, :].copy_(cache[:, b : b + self.page_size, :, :])
|
1336 | 1337 | cache[:, rotation[-1] : rotation[-1] + self.page_size, :, :].copy_(buffer[:, :, :, :])
|
1337 | 1338 |
|
@@ -2392,7 +2393,7 @@ def allocate_pages(self):
|
2392 | 2393 | # Metrics
|
2393 | 2394 |
|
2394 | 2395 | self.total_pages += len(seq.allocated_pages)
|
2395 |
| - for page_a, page_b in itertools.pairwise(seq.allocated_pages): |
| 2396 | + for page_a, page_b in pairwise(seq.allocated_pages): |
2396 | 2397 | if page_b.page_index != page_a.page_index + 1:
|
2397 | 2398 | self.non_sequential_pages += 1
|
2398 | 2399 |
|
|
0 commit comments