Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
3892d09f
Unverified
Commit
3892d09f
authored
Oct 20, 2021
by
Meng Zhou
Committed by
GitHub
Oct 19, 2021
Browse files
update to_py_obj to support np.number (#14064)
Co-authored-by:
眸浩
<
mouhao.zm@alibaba-inc.com
>
parent
122c2f81
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
src/transformers/file_utils.py
src/transformers/file_utils.py
+1
-1
No files found.
src/transformers/file_utils.py
View file @
3892d09f
...
@@ -1946,7 +1946,7 @@ def to_py_obj(obj):
...
@@ -1946,7 +1946,7 @@ def to_py_obj(obj):
return
obj
.
detach
().
cpu
().
tolist
()
return
obj
.
detach
().
cpu
().
tolist
()
elif
is_flax_available
()
and
_is_jax
(
obj
):
elif
is_flax_available
()
and
_is_jax
(
obj
):
return
np
.
asarray
(
obj
).
tolist
()
return
np
.
asarray
(
obj
).
tolist
()
elif
isinstance
(
obj
,
np
.
ndarray
):
elif
isinstance
(
obj
,
(
np
.
ndarray
,
np
.
number
)):
# tolist also works on 0d np arrays
return
obj
.
tolist
()
return
obj
.
tolist
()
else
:
else
:
return
obj
return
obj
...
...
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