Skip to content

Commit

Permalink
temporary fix for py37 (combinedloader) (#215)
Browse files Browse the repository at this point in the history
* temporary fix for py37 (combinedloader)
  • Loading branch information
ndem0 authored Nov 22, 2023
1 parent 6c46642 commit 42cf7fc
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,6 @@ dmypy.json
# Cython debug symbols
cython_debug/

# Lightning logs dir
*/lightning_logs/*
lightning_logs/*
2 changes: 1 addition & 1 deletion pina/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,4 +237,4 @@ def __iter__(self):
'output': self.batch_output_pts[idx_],
'condition': self.batch_data_conditions[idx_],
}
yield d
yield d
7 changes: 6 additions & 1 deletion pina/solvers/garom.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
""" Module for GAROM """

import torch
import sys
try:
from torch.optim.lr_scheduler import LRScheduler # torch >= 2.0
except ImportError:
Expand Down Expand Up @@ -251,7 +252,11 @@ def training_step(self, batch, batch_idx):

for condition_id in range(condition_idx.min(), condition_idx.max()+1):

condition_name = dataloader.condition_names[condition_id]
if sys.version_info >= (3, 8):
condition_name = dataloader.condition_names[condition_id]
else:
condition_name = dataloader.loaders.condition_names[condition_id]

condition = self.problem.conditions[condition_name]
pts = batch['pts'].detach()
out = batch['output']
Expand Down
6 changes: 5 additions & 1 deletion pina/solvers/pinn.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
except ImportError:
from torch.optim.lr_scheduler import _LRScheduler as LRScheduler # torch < 2.0

import sys
from torch.optim.lr_scheduler import ConstantLR

from .solver import SolverInterface
Expand Down Expand Up @@ -143,7 +144,10 @@ def training_step(self, batch, batch_idx):

for condition_id in range(condition_idx.min(), condition_idx.max()+1):

condition_name = dataloader.condition_names[condition_id]
if sys.version_info >= (3, 8):
condition_name = dataloader.condition_names[condition_id]
else:
condition_name = dataloader.loaders.condition_names[condition_id]
condition = self.problem.conditions[condition_name]
pts = batch['pts']

Expand Down
6 changes: 5 additions & 1 deletion pina/solvers/supervised.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
""" Module for SupervisedSolver """
import torch
import sys
try:
from torch.optim.lr_scheduler import LRScheduler # torch >= 2.0
except ImportError:
Expand Down Expand Up @@ -98,7 +99,10 @@ def training_step(self, batch, batch_idx):

for condition_id in range(condition_idx.min(), condition_idx.max()+1):

condition_name = dataloader.condition_names[condition_id]
if sys.version_info >= (3, 8):
condition_name = dataloader.condition_names[condition_id]
else:
condition_name = dataloader.loaders.condition_names[condition_id]
condition = self.problem.conditions[condition_name]
pts = batch['pts']
out = batch['output']
Expand Down

0 comments on commit 42cf7fc

Please sign in to comment.