mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-31 02:02:21 +06:00
[fix] bug in BatchEncoding.__getitem__ (#24293)
Co-authored-by: luchen <luchen@luchendeMBP.lan>
This commit is contained in:
parent
372f50030b
commit
6cd34d451c
@ -242,7 +242,7 @@ class BatchEncoding(UserDict):
|
||||
elif self._encodings is not None:
|
||||
return self._encodings[item]
|
||||
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:
|
||||
raise KeyError(
|
||||
"Invalid key. Only three types of key are available: "
|
||||
|
Loading…
Reference in New Issue
Block a user