Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
6cd34d45
Unverified
Commit
6cd34d45
authored
Jun 15, 2023
by
jiangmingyan
Committed by
GitHub
Jun 15, 2023
Browse files
[fix] bug in BatchEncoding.__getitem__ (#24293)
Co-authored-by:
luchen
<
luchen@luchendeMBP.lan
>
parent
372f5003
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
src/transformers/tokenization_utils_base.py
src/transformers/tokenization_utils_base.py
+1
-1
No files found.
src/transformers/tokenization_utils_base.py
View file @
6cd34d45
...
@@ -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: "
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment