votes up 4

Unable to convert output to PyTorch tensors format, PyTorch is not installed.

Exception Class:

Raise code

            import tensorflow as tf

            as_tensor = tf.constant
            is_tensor = tf.is_tensor
        elif tensor_type == TensorType.PYTORCH:
            if not is_torch_available():
                raise ImportError("Unable to convert output to PyTorch tensors format, PyTorch is not installed.")
            import torch

            as_tensor = torch.tensor
            is_tensor = torch.is_tensor
        elif tensor_type == TensorType.JAX:
            if not is_flax_available():
                raise ImportError("Unable to convert output to JAX tensors format, JAX is not installed.")
😲 Agile task management is now easier than calling a taxi. #Tracklify
🙏 Scream for help to Ukraine
Today, 2nd July 2022, Russia continues bombing and firing Ukraine. Don't trust Russia, they are bombing us and brazenly lying in same time they are not doing this 😠, civilians and children are dying too! We are screaming and asking exactly you to help us, we want to survive, our families, children, older ones.
Please spread the information, and ask your governemnt to stop Russia by any means. We promise to work extrahard after survival to make the world safer place for all.

Ways to fix

votes up 0 votes down

Error code:

from transformers import BatchEncoding

data = {"inputs": [[123], [456]], "labels": [01]}

encod = BatchEncoding(data)

ec = encod.convert_to_tensors('pt')

Fix version:

Make sure you have installed Torch

pip install torch
Jul 16, 2021 anonim answer
anonim 13.0k

Add a possible fix

Please authorize to post fix