-
Notifications
You must be signed in to change notification settings - Fork 55
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
"NameError: name 'torch' is not defined" but torch is installed and imported #36
Comments
Can you please follow these directions to install pytorch If it still does not work, please provide the specific versions of packages you have installed using |
@giulianoformisano could you try to verify whether you installed torch correctly? You could try |
Thanks a lot, unfortunately, I couldn't fix the issue following the instructions (https://pytorch.org/get-started/locally/). Please find all my installed packages:
|
Everything was working fine earlier this year. When I tried running the script this time around, I encountered the same problem as @giulianoformisano. Some context: I work with an M1 mac and
I tried to fix it by adding
After that, I added Anyway, running the program with the above adjustments partially fixed the problem. Now, I am stuck again with a segmentation error.
I use this package heavily (and cite it whenever I can). It would be a shame for it not to work in future projects. :( |
Update: I switched environments (switched to pytorch-nightly) using
|
Interesting. Thanks @wdwgonzales . It sounds like the segmentation fault from #26 is solved by using the latest (nightly) build and adding What computer architecture and OS are you using @giulianoformisano ? Also what version of Python? |
Thanks a lot for your inputs! I followed @wdwgonzales, but the procedure didn't fix the issue. I am currently using an M2, python versions 3.9.6 and 3.8.8. I also tried the same procedure on Windows Server 2012, yet getting the same error. |
downgrading torch to 1.12.1 and torchvision to 0.13.1 worked for me |
@MuraliRamRavipati thank you so much! Downgrading torch to 1.12.1 and torchvision to 0.13.1 fixed the issue. I created a new environment (python 3.8.8) and followed MuraliRamRavipati's suggestion. |
After creating a virtual environment, I tried to install and import m3inference:
pip install m3inference
import m3inference
But I get the following error, how could I fix it?
I tried to install and import torch before doing the same with m3inference.
Thanks!
The text was updated successfully, but these errors were encountered: