Skip to content

Commit 400a49c

Browse files
dspgbgjdfacebook-github-bot
authored andcommitted
random sample from set
Summary: Starting Python 3.11, the random.sample population must be a sequence, and no longer auto-converts sets to lists. Fix bug in the d2 dataloader by convert set to list first Differential Revision: D72924685 fbshipit-source-id: bc6328158980da94e597ef7abfe5e8e241ecab4a
1 parent 9604f59 commit 400a49c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

detectron2/data/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def __getitem__(self, idx):
130130
# _map_func fails for this idx, use a random new index from the pool
131131
retry_count += 1
132132
self._fallback_candidates.discard(cur_idx)
133-
cur_idx = self._rng.sample(self._fallback_candidates, k=1)[0]
133+
cur_idx = self._rng.sample(list(self._fallback_candidates), k=1)[0]
134134

135135
if retry_count >= 3:
136136
logger = logging.getLogger(__name__)

0 commit comments

Comments
 (0)