AttributeError: Please Help!

Hi, I am running a script that uses torch and I keep getting this error:

AttributeError: partially initialized module ‘torch’ has no attribute ‘Tensor’ (most likely due to a circular import)

So far I have tried uninstalling and reinstalling torch, but that has not worked. I am unsure what else to try and any help would be greatly appreciated.

Are you executing your script in a folder containing a torch.py script or inside the PyTorch source code directory?

Hi,
I am not doing either of these things. I am executing it in a script located in a github repo I cloned, and this repo doesn’t have a torch.py folder.

I noticed that my torch.py script is located here and not in my torch folder:

Is this incorrect? Or do you have any other advice for this kind of issue?

The backends/torch.py file should not be a problem unless you are executing your custom script from the same folder (I don’t think you have created your script in the opt_einsum repository).
In this case, unfortunately I don’t know what might be causing the issues assuming your current working directory does not contain files conflicting with the torch namespace.