-
Notifications
You must be signed in to change notification settings - Fork 73
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
Update tutorials 1-12 to current version (no Plotter) #463
base: 0.2
Are you sure you want to change the base?
Conversation
MatteB03
commented
Feb 26, 2025
- Changed imports to match current folders
- Changed notation where version differed from master
- Deleted unnecessary inputs and modified outdated ones
- Minor changes to solve tutorial-specific errors
- Accordingly changed tutorial.py files
- Added tmp_poisson_inverse folder in tutorial7 to store epochs log
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! Thank you for updating the tutorials, it is really an incredible work :) I have made few comments on the PR, in particular the missing plots and some others. For plotting the solution you can use matplotlib
, while for the loss the tensorboard
extension should be fine.
pina/model/block/convolution_2d.py
Outdated
@@ -265,7 +265,7 @@ def _make_grid_transpose(self, X): | |||
|
|||
""" | |||
# initialize to all zeros | |||
tmp = torch.zeros_like(X) | |||
tmp = torch.zeros_like(X).as_subclass(torch.Tensor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this, and use use_lt=False
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, this block should work only without LabelTensor? I did this to make compatible both with and without LabelTensor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all blocks should work with both, if it is needed ok!
pina/label_tensor.py
Outdated
@@ -448,6 +448,10 @@ def __getitem__(self, index): | |||
|
|||
# Retrieve selected tensor and labels | |||
selected_tensor = super().__getitem__(index) | |||
if hasattr(self, "_labels"): | |||
original_labels=self._labels |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this? @FilippoOlivo is it needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this functionality is also present in 0.1
Line 290 in f0bff24
if hasattr(self, "labels"): |
tutorials/tutorial1/tutorial.py
Outdated
|
||
pl = Plotter() | ||
pl.plot_samples(problem=problem) | ||
#pl = Plotter() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should be able to plot the solution, please do the plot with matplotlib
get_ipython().run_line_magic('matplotlib', 'inline') | ||
|
||
import matplotlib.pyplot as plt | ||
plt.style.use('tableau-colorblind10') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should use the same palette in every tutorial for consistency. We can think of having a PINA palette but maybe we can do it in a second iteration.
# In[2]: | ||
|
||
|
||
get_ipython().system('pip install git+https://github.com/mathLab/Smithers.git #if required --break-system-packages') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove this, maybe we can create optional dependencies for pina tutorials (see here)
Also @MatteB03 and @FilippoOlivo there are conflicts to be solver inside |