Skip to content

Commit 0f07783

Browse files
authored
Fix incorrect retry count check in LazyLLMDataset.__getitem__ (#3845)
1 parent 4d74df0 commit 0f07783

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

swift/llm/dataset/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ def __init__(self,
8181

8282
def __getitem__(self, idx: int) -> Dict[str, Any]:
8383
for i in range(self.n_try_fetch):
84+
n_try = i
8485
if i == 0:
8586
i = idx
8687
else:
@@ -90,7 +91,7 @@ def __getitem__(self, idx: int) -> Dict[str, Any]:
9091
try:
9192
return self.encode_func(data)
9293
except Exception:
93-
if i == self.n_try_fetch - 1:
94+
if n_try == self.n_try_fetch - 1:
9495
if self.strict:
9596
logger.warning('To avoid errors, you can pass `strict=False`.')
9697
raise

0 commit comments

Comments
 (0)