Unverified Commit 6cd34d45 authored by jiangmingyan's avatar jiangmingyan Committed by GitHub
Browse files

[fix] bug in BatchEncoding.__getitem__ (#24293)


Co-authored-by: default avatarluchen <luchen@luchendeMBP.lan>
parent 372f5003
...@@ -242,7 +242,7 @@ class BatchEncoding(UserDict): ...@@ -242,7 +242,7 @@ class BatchEncoding(UserDict):
elif self._encodings is not None: elif self._encodings is not None:
return self._encodings[item] return self._encodings[item]
elif isinstance(item, slice): elif isinstance(item, slice):
return {key: self.data[key][slice] for key in self.data.keys()} return {key: self.data[key][item] for key in self.data.keys()}
else: else:
raise KeyError( raise KeyError(
"Invalid key. Only three types of key are available: " "Invalid key. Only three types of key are available: "
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment