Skip to content

Commit ad271a6

Browse files
committed
[Safetensors] Fix safetensors shape (PaddlePaddle#8702)
* Update sequence_parallel for predict * Do not save moe_group * Fix safetensors reading
1 parent db99efd commit ad271a6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

paddlenlp/utils/safetensors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def __getitem__(self, index):
177177
span = self.bits
178178
for i, (start, stop, step) in enumerate(zip(out_start[::-1], out_stop[::-1], out_step[::-1])):
179179
if len(indices) == 0:
180-
if start == 0 and stop == self.shape[i]:
180+
if start == 0 and stop == self.shape[::-1][i]:
181181
pass
182182
# We haven't started to slice yet, just increase the span
183183
else:
@@ -194,7 +194,7 @@ def __getitem__(self, index):
194194
newindices.append((old_start + offset, old_stop + offset))
195195
indices = newindices
196196
assert len(indices) == capacity, f"error {capacity} {len(indices)}"
197-
span *= self.shape[-(i + 1)]
197+
span *= self.shape[::-1][i]
198198

199199
if len(indices) == 0:
200200
indices.append((0, self.nbytes))

0 commit comments

Comments
 (0)