Skip to content

Commit

Permalink
Fix smart check (huggingface#25955)
Browse files Browse the repository at this point in the history
* fix

* fix

* fix

---------

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
  • Loading branch information
2 people authored and parambharat committed Sep 26, 2023
1 parent a7c305e commit 228646d
Showing 1 changed file with 5 additions and 5 deletions.
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

0 comments on commit 228646d

Please sign in to comment.