-
Notifications
You must be signed in to change notification settings - Fork 41
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
rank_zero_only moved to lightning.fabric.utilities.rank_zero #2
Comments
I think these imports were the earlier locations for these libraries. This import is fine for What version of In terms of pinning libraries, this is what tags on This is the frozen version for |
This is another difference introduced since the PDF was built. You seem to have newer versions of `torch` libraries than ISLP
Try a fresh conda environment with these requirements:
https://github.com/intro-stat-learning/ISLP_labs/blob/v2.1/requirements.txt
Alternatively, `pip install -U ISLP` should give you a version that rubs with the newer torch libs
Get Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: Jaco Stroebel ***@***.***>
Sent: Monday, August 21, 2023 2:59:20 AM
To: intro-stat-learning/ISLP ***@***.***>
Cc: Jonathan Taylor ***@***.***>; Comment ***@***.***>
Subject: Re: [intro-stat-learning/ISLP] rank_zero_only moved to lightning.fabric.utilities.rank_zero (Issue #2)
I managed to some of the way through the Ch10 lab using the changes that I recommended above. I hit a roadblock again with lightning requiring Accuracy to be passed a positional argument.
It looks like I am a few patch versions behind for ISLP, I will update and see if that fixes my issue.
[image]<https://user-images.githubusercontent.com/5149902/261988209-de44a1f6-a0df-4e72-b77f-b8f6f3bdf4e5.png> [image] <https://user-images.githubusercontent.com/5149902/261988463-19f5626d-a1ba-4276-ada3-4b8a97aef9bd.png>
TypeError Traceback (most recent call last)
[/Volumes/untitled/tx/learning/deep_learning.py](https://file+.vscode-resource.vscode-cdn.net/Volumes/untitled/tx/learning/deep_learning.py) in line 2
[167](file:///Volumes/untitled/tx/learning/deep_learning.py?line=166) # %%
----> [168](file:///Volumes/untitled/tx/learning/deep_learning.py?line=167) mnist_module = SimpleModule.classification(mnist_model)
[169](file:///Volumes/untitled/tx/learning/deep_learning.py?line=168) mnist_logger = CSVLogger("logs", name="MNIST")
File [~/mambaforge/envs/learning/lib/python3.10/site-packages/ISLP/torch/lightning.py:216](https://file+.vscode-resource.vscode-cdn.net/Volumes/untitled/tx/learning/~/mambaforge/envs/learning/lib/python3.10/site-packages/ISLP/torch/lightning.py:216), in SimpleModule.classification(model, metrics, device, **kwargs)
[214](file:///Users/kolmogrov/mambaforge/envs/learning/lib/python3.10/site-packages/ISLP/torch/lightning.py?line=213) loss = nn.CrossEntropyLoss()
[215](file:///Users/kolmogrov/mambaforge/envs/learning/lib/python3.10/site-packages/ISLP/torch/lightning.py?line=214) if 'accuracy' not in metrics:
--> [216](file:///Users/kolmogrov/mambaforge/envs/learning/lib/python3.10/site-packages/ISLP/torch/lightning.py?line=215) metrics['accuracy'] = Accuracy()
[217](file:///Users/kolmogrov/mambaforge/envs/learning/lib/python3.10/site-packages/ISLP/torch/lightning.py?line=216) if device is not None:
[218](file:///Users/kolmogrov/mambaforge/envs/learning/lib/python3.10/site-packages/ISLP/torch/lightning.py?line=217) for key, metric in metrics:
TypeError: Accuracy.__new__() missing 1 required positional argument: 'task'
ps. Thank you for your book. I have worked through the rest of the labs and they are great.
—
Reply to this email directly, view it on GitHub<#2 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AACTM2YPR6YGULH2OT4GAW3XWMWPRANCNFSM6AAAAAA3FFHLFA>.
You are receiving this because you commented.Message ID: ***@***.***>
|
BTW, there is also a forum at `statlearning.com` that has some of these issues.
I think issues on GitHub is easier but some may pop up there as well.
Get Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: Jonathan E. Taylor ***@***.***>
Sent: Monday, August 21, 2023 11:31:22 AM
To: intro-stat-learning/ISLP ***@***.***>; intro-stat-learning/ISLP ***@***.***>
Cc: Jonathan Taylor ***@***.***>; Comment ***@***.***>
Subject: Re: [intro-stat-learning/ISLP] rank_zero_only moved to lightning.fabric.utilities.rank_zero (Issue #2)
This is another difference introduced since the PDF was built. You seem to have newer versions of `torch` libraries than ISLP
Try a fresh conda environment with these requirements:
https://github.com/intro-stat-learning/ISLP_labs/blob/v2.1/requirements.txt
Alternatively, `pip install -U ISLP` should give you a version that rubs with the newer torch libs
Get Outlook for Android<https://aka.ms/AAb9ysg>
________________________________
From: Jaco Stroebel ***@***.***>
Sent: Monday, August 21, 2023 2:59:20 AM
To: intro-stat-learning/ISLP ***@***.***>
Cc: Jonathan Taylor ***@***.***>; Comment ***@***.***>
Subject: Re: [intro-stat-learning/ISLP] rank_zero_only moved to lightning.fabric.utilities.rank_zero (Issue #2)
I managed to some of the way through the Ch10 lab using the changes that I recommended above. I hit a roadblock again with lightning requiring Accuracy to be passed a positional argument.
It looks like I am a few patch versions behind for ISLP, I will update and see if that fixes my issue.
[image]<https://user-images.githubusercontent.com/5149902/261988209-de44a1f6-a0df-4e72-b77f-b8f6f3bdf4e5.png> [image] <https://user-images.githubusercontent.com/5149902/261988463-19f5626d-a1ba-4276-ada3-4b8a97aef9bd.png>
TypeError Traceback (most recent call last)
[/Volumes/untitled/tx/learning/deep_learning.py](https://file+.vscode-resource.vscode-cdn.net/Volumes/untitled/tx/learning/deep_learning.py) in line 2
[167](file:///Volumes/untitled/tx/learning/deep_learning.py?line=166) # %%
----> [168](file:///Volumes/untitled/tx/learning/deep_learning.py?line=167) mnist_module = SimpleModule.classification(mnist_model)
[169](file:///Volumes/untitled/tx/learning/deep_learning.py?line=168) mnist_logger = CSVLogger("logs", name="MNIST")
File [~/mambaforge/envs/learning/lib/python3.10/site-packages/ISLP/torch/lightning.py:216](https://file+.vscode-resource.vscode-cdn.net/Volumes/untitled/tx/learning/~/mambaforge/envs/learning/lib/python3.10/site-packages/ISLP/torch/lightning.py:216), in SimpleModule.classification(model, metrics, device, **kwargs)
[214](file:///Users/kolmogrov/mambaforge/envs/learning/lib/python3.10/site-packages/ISLP/torch/lightning.py?line=213) loss = nn.CrossEntropyLoss()
[215](file:///Users/kolmogrov/mambaforge/envs/learning/lib/python3.10/site-packages/ISLP/torch/lightning.py?line=214) if 'accuracy' not in metrics:
--> [216](file:///Users/kolmogrov/mambaforge/envs/learning/lib/python3.10/site-packages/ISLP/torch/lightning.py?line=215) metrics['accuracy'] = Accuracy()
[217](file:///Users/kolmogrov/mambaforge/envs/learning/lib/python3.10/site-packages/ISLP/torch/lightning.py?line=216) if device is not None:
[218](file:///Users/kolmogrov/mambaforge/envs/learning/lib/python3.10/site-packages/ISLP/torch/lightning.py?line=217) for key, metric in metrics:
TypeError: Accuracy.__new__() missing 1 required positional argument: 'task'
ps. Thank you for your book. I have worked through the rest of the labs and they are great.
—
Reply to this email directly, view it on GitHub<#2 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AACTM2YPR6YGULH2OT4GAW3XWMWPRANCNFSM6AAAAAA3FFHLFA>.
You are receiving this because you commented.Message ID: ***@***.***>
|
https://github.com/intro-stat-learning/ISLP/blob/bd0af3474fb4b6306c749a194b350199cd332a49/ISLP/torch/lightning.py#L17C51-L17C51
The fix for this is possibly to pin
pytorch_lightning
to <2.0 or to change the import tofrom pytorch_lightning.utilities.rank_zero import rank_zero_only
.I can confirm that the import at that location works. I haven't tested it against the lab for Ch10 yet though.
There is a similar issue for the
seed_everything
import for ch10. That can be handled by installing the entire lightning package and changing the import tofrom lightning_fabric.utilities.seed import seed_everything
. Pinningpytorch_lightning
might be the better course of action in this case.The text was updated successfully, but these errors were encountered: