temporary fix for py37 (combinedloader) (#215)
* temporary fix for py37 (combinedloader)
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -137,3 +137,6 @@ dmypy.json
|
|||||||
# Cython debug symbols
|
# Cython debug symbols
|
||||||
cython_debug/
|
cython_debug/
|
||||||
|
|
||||||
|
# Lightning logs dir
|
||||||
|
*/lightning_logs/*
|
||||||
|
lightning_logs/*
|
||||||
|
|||||||
@@ -237,4 +237,4 @@ class SamplePointLoader:
|
|||||||
'output': self.batch_output_pts[idx_],
|
'output': self.batch_output_pts[idx_],
|
||||||
'condition': self.batch_data_conditions[idx_],
|
'condition': self.batch_data_conditions[idx_],
|
||||||
}
|
}
|
||||||
yield d
|
yield d
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
""" Module for GAROM """
|
""" Module for GAROM """
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
import sys
|
||||||
try:
|
try:
|
||||||
from torch.optim.lr_scheduler import LRScheduler # torch >= 2.0
|
from torch.optim.lr_scheduler import LRScheduler # torch >= 2.0
|
||||||
except ImportError:
|
except ImportError:
|
||||||
@@ -251,7 +252,11 @@ class GAROM(SolverInterface):
|
|||||||
|
|
||||||
for condition_id in range(condition_idx.min(), condition_idx.max()+1):
|
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]
|
condition = self.problem.conditions[condition_name]
|
||||||
pts = batch['pts'].detach()
|
pts = batch['pts'].detach()
|
||||||
out = batch['output']
|
out = batch['output']
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
from torch.optim.lr_scheduler import _LRScheduler as LRScheduler # torch < 2.0
|
from torch.optim.lr_scheduler import _LRScheduler as LRScheduler # torch < 2.0
|
||||||
|
|
||||||
|
import sys
|
||||||
from torch.optim.lr_scheduler import ConstantLR
|
from torch.optim.lr_scheduler import ConstantLR
|
||||||
|
|
||||||
from .solver import SolverInterface
|
from .solver import SolverInterface
|
||||||
@@ -143,7 +144,10 @@ class PINN(SolverInterface):
|
|||||||
|
|
||||||
for condition_id in range(condition_idx.min(), condition_idx.max()+1):
|
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]
|
condition = self.problem.conditions[condition_name]
|
||||||
pts = batch['pts']
|
pts = batch['pts']
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
""" Module for SupervisedSolver """
|
""" Module for SupervisedSolver """
|
||||||
import torch
|
import torch
|
||||||
|
import sys
|
||||||
try:
|
try:
|
||||||
from torch.optim.lr_scheduler import LRScheduler # torch >= 2.0
|
from torch.optim.lr_scheduler import LRScheduler # torch >= 2.0
|
||||||
except ImportError:
|
except ImportError:
|
||||||
@@ -98,7 +99,10 @@ class SupervisedSolver(SolverInterface):
|
|||||||
|
|
||||||
for condition_id in range(condition_idx.min(), condition_idx.max()+1):
|
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]
|
condition = self.problem.conditions[condition_name]
|
||||||
pts = batch['pts']
|
pts = batch['pts']
|
||||||
out = batch['output']
|
out = batch['output']
|
||||||
|
|||||||
Reference in New Issue
Block a user