File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 2525from typing import Iterator , Tuple
2626
2727import torch
28+ from packaging import version
2829from torch .utils .data import Dataset
29- from torch .utils .data .distributed import DistributedSampler , T_co
30+
31+
32+ if version .parse (torch .__version__ ) >= version .parse ("2.5.0" ):
33+ from torch .utils .data .distributed import DistributedSampler , _T_co
34+ else :
35+ from torch .utils .data .distributed import DistributedSampler
36+ from torch .utils .data .distributed import T_co as _T_co
3037
3138from lighteval .tasks .requests import (
3239 GreedyUntilRequest ,
@@ -318,7 +325,7 @@ class GenDistributedSampler(DistributedSampler):
318325 as our samples are sorted by length.
319326 """
320327
321- def __iter__ (self ) -> Iterator [T_co ]:
328+ def __iter__ (self ) -> Iterator [_T_co ]:
322329 if self .shuffle :
323330 # deterministically shuffle based on epoch and seed
324331 g = torch .Generator ()
You can’t perform that action at this time.
0 commit comments