-
Notifications
You must be signed in to change notification settings - Fork 294
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
ImportError: cannot import name 'EarlyStopping' from 'pytorchtools' #15
Comments
Hi Hripsime,
You can not download this code using pip. You need to download this project to your computer and install the dependencies using the requirements.txt file to use it.
Best regards,
Bjarte
…________________________________
From: Hripsime Snkhchyan ***@***.***>
Sent: Monday, April 11, 2022 4:53 PM
To: Bjarten/early-stopping-pytorch ***@***.***>
Cc: Bjarte Mehus Sunde ***@***.***>; Mention ***@***.***>
Subject: [Bjarten/early-stopping-pytorch] ImportError: cannot import name 'EarlyStopping' from 'pytorchtools' (Issue #15)
Hello @Bjarten<https://github.com/Bjarten>
I am trying to use your approach for the early stopping. I installed pytorchtools by using "pip install pytorchtools"
Then I wanted to import EarlyStopping using "from pytorchtools import EarlyStopping", but eventually I received the following error:
ImportError: cannot import name 'EarlyStopping' from 'pytorchtools' (C:\Users\Name\anaconda3\envs\abys\lib\site-packages\pytorchtools_init_.py)
Can you please let me know why I am receiving this error and how to fix it potentially? Thank you in advance!
—
Reply to this email directly, view it on GitHub<#15>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AA5QP46TVLNGPQPAAMMSA53VEQ4GRANCNFSM5TDO5M5Q>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
@Bjarten thanks for your reply! I downloaded the project and installed the dependencies using pip install -r requirements.txt. Can you please let me know how to fix this issue to make it work eventually. Thanks in advance! |
You need to add pytorchtools.py to the same folder as the python script you are running, or add it's location to the PYTHONPATH environmental variable.
Bjarte
Get Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: Hripsime Snkhchyan ***@***.***>
Sent: Tuesday, April 19, 2022 5:15:20 PM
To: Bjarten/early-stopping-pytorch ***@***.***>
Cc: Bjarte Mehus Sunde ***@***.***>; Mention ***@***.***>
Subject: Re: [Bjarten/early-stopping-pytorch] ImportError: cannot import name 'EarlyStopping' from 'pytorchtools' (Issue #15)
@Bjarten<https://github.com/Bjarten> thanks for your reply! I downloaded the project and installed the dependencies using pip install -r requirements.txt.
But when I do "from pytorchtools import EarlyStopping", it gives me this error
ImportError: cannot import name 'EarlyStopping' from 'pytorchtools' (C:\Users\Name\anaconda3\envs\abys\lib\site-packages\pytorchtools_init_.py)
Can you please let me know how to fix this issue to make it work eventually. Thanks in advance!
—
Reply to this email directly, view it on GitHub<#15 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AA5QP475ARIXLXM3G5RKCVLVF3EYRANCNFSM5TDO5M5Q>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Yes, you can try that
Get Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: Hripsime Snkhchyan ***@***.***>
Sent: Tuesday, April 19, 2022 5:42:36 PM
To: Bjarten/early-stopping-pytorch ***@***.***>
Cc: Bjarte Mehus Sunde ***@***.***>; Mention ***@***.***>
Subject: Re: [Bjarten/early-stopping-pytorch] ImportError: cannot import name 'EarlyStopping' from 'pytorchtools' (Issue #15)
@Bjarten<https://github.com/Bjarten> thanks for your quick reply. For the moment I am using a Jupyter Notebook file (.ipynb) and I need to add the pytorchtools.py file in the same folder where my notebook is located?
—
Reply to this email directly, view it on GitHub<#15 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AA5QP42YDHE7O4KYDX65WG3VF3H6ZANCNFSM5TDO5M5Q>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
@Bjarten thanks a lot, it worked eventually when I moved pytorchtools.py file to the corresponding folder 👍 🥇 |
Great! Glad to hear you got it to work.
Get Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: Hripsime Snkhchyan ***@***.***>
Sent: Tuesday, April 19, 2022 6:56:21 PM
To: Bjarten/early-stopping-pytorch ***@***.***>
Cc: Bjarte Mehus Sunde ***@***.***>; Mention ***@***.***>
Subject: Re: [Bjarten/early-stopping-pytorch] ImportError: cannot import name 'EarlyStopping' from 'pytorchtools' (Issue #15)
@Bjarten<https://github.com/Bjarten> thanks a lot, it worked eventually when I moved pytorchtools.py file to the corresponding folder 👍 🥇
—
Reply to this email directly, view it on GitHub<#15 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AA5QP43GRWXURXLS5SGKPPDVF3QTLANCNFSM5TDO5M5Q>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Hello @Bjarten. Thanks for creating a nice EarlyStopping. It worked fine with my model, but I got a bit strange outcome "nan" values at some point and could not figure out why. Any ideas why I could get those "nan" values? Thanks in advance :) |
Take a look at this link
https://stackoverflow.com/questions/66648432/pytorch-test-loss-becoming-nan-after-some-iteration
Get Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: Hripsime Snkhchyan ***@***.***>
Sent: Wednesday, April 20, 2022 11:18:21 PM
To: Bjarten/early-stopping-pytorch ***@***.***>
Cc: Bjarte Mehus Sunde ***@***.***>; Mention ***@***.***>
Subject: Re: [Bjarten/early-stopping-pytorch] ImportError: cannot import name 'EarlyStopping' from 'pytorchtools' (Issue #15)
Hello @Bjarten<https://github.com/Bjarten>. Thanks for creating a nice EarlyStopping class in pytorchtool.py. It worked fine with my model, I just got a bit strange outcome "nan" values at some point and could not figure out why.
Any ideas why I could get those "nan" values? Thanks in advance :)
[NAN_value]<https://user-images.githubusercontent.com/42246765/164324580-86f8b9d8-cd64-4f85-bbb7-9a010e1ba237.png>
—
Reply to this email directly, view it on GitHub<#15 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AA5QP47HE2OEJUQSECI7S73VGBYB3ANCNFSM5TDO5M5Q>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Yes, edit the existing variable by adding your path
…________________________________
From: Hripsime Snkhchyan ***@***.***>
Sent: Tuesday, April 19, 2022 5:54 PM
To: Bjarten/early-stopping-pytorch ***@***.***>
Cc: Bjarte Mehus Sunde ***@***.***>; Mention ***@***.***>
Subject: Re: [Bjarten/early-stopping-pytorch] ImportError: cannot import name 'EarlyStopping' from 'pytorchtools' (Issue #15)
@Bjarten<https://github.com/Bjarten> no it did not help unfortunately moving the pytorchtools.py file to the same folder.
I add new variable in "System variables" to add a path of pytorchtools.py file. This is a correct way or I need to modify it?
C:\Users\Hripsime\anaconda3\envs\abys\Lib\site-packages\pytorchtools\pytorchtools.py
[image]<https://user-images.githubusercontent.com/42246765/164044464-b2207ad6-d68f-4520-b2f6-2c4682a32555.png>
—
Reply to this email directly, view it on GitHub<#15 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AA5QP46CNSIEP62VNLY4SMLVF3JNFANCNFSM5TDO5M5Q>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Hello @Bjarten
I am trying to use your approach for the early stopping. I installed pytorchtools by using "pip install pytorchtools"
Then I wanted to import EarlyStopping using "from pytorchtools import EarlyStopping", but eventually I received the following error:
ImportError: cannot import name 'EarlyStopping' from 'pytorchtools' (C:\Users\Name\anaconda3\envs\abys\lib\site-packages\pytorchtools_init_.py)
Can you please let me know why I am receiving this error and how to fix it potentially? Thank you in advance!
The text was updated successfully, but these errors were encountered: