Skip to content
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

Open
wants to merge 5 commits into
base: 0.2
Choose a base branch
from

Conversation

MatteB03
Copy link

  • 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

Copy link
Collaborator

@dario-coscia dario-coscia left a 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.

@@ -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)
Copy link
Collaborator

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

Copy link
Member

@FilippoOlivo FilippoOlivo Feb 26, 2025

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

Copy link
Collaborator

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!

@@ -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
Copy link
Collaborator

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?

Copy link
Member

@FilippoOlivo FilippoOlivo Feb 26, 2025

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

if hasattr(self, "labels"):


pl = Plotter()
pl.plot_samples(problem=problem)
#pl = Plotter()
Copy link
Collaborator

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')
Copy link
Collaborator

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')
Copy link
Collaborator

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)

@dario-coscia
Copy link
Collaborator

dario-coscia commented Feb 26, 2025

Also @MatteB03 and @FilippoOlivo there are conflicts to be solver inside pina/label_tensor.py. I think they are basically the same code, do you agree?

@dario-coscia dario-coscia added pr-to-fix Label for PR that needs modification v0.2 implementation in v0.2 labels Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-to-fix Label for PR that needs modification v0.2 implementation in v0.2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants