Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix smart check #25955

Merged
merged 3 commits into from
Sep 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/transformers/utils/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ def infer_framework_from_repr(x):
Tries to guess the framework of an object `x` from its repr (brittle but will help in `is_tensor` to try the
frameworks in a smart order, without the need to import the frameworks).
"""
representation = repr(x)
if representation.startswith("tensor"):
representation = str(type(x))
if representation.startswith("<class 'torch."):
return "pt"
elif "tf.Tensor" in representation:
elif representation.startswith("<class 'tensorflow."):
return "tf"
elif representation.startswith("Array"):
elif representation.startswith("<class 'jax"):
return "jax"
elif representation.startswith("array"):
elif representation.startswith("<class 'numpy."):
return "np"


Expand Down
Loading