mathLab / PINA

Physics-Informed Neural networks for Advanced modeling
https://mathlab.github.io/PINA/
MIT License
389 stars 65 forks source link

CombinedLoader' object has no attribute 'condition_names' #200

Closed ndem0 closed 11 months ago

ndem0 commented 1 year ago

Describe the bug The error FAILED tests/test_solvers/test_pinn.py::test_train_cpu - AttributeError: 'CombinedLoader' object has no attribute 'condition_names' occurs when running Python3.7

To Reproduce python3.7 -m pytest tests/test_solver/test_pinn.py -k train_cpu

Output

    def training_step(self, batch, batch_idx):
        """PINN solver training step.

        :param batch: The batch element in the dataloader.
        :type batch: tuple
        :param batch_idx: The batch index.
        :type batch_idx: int
        :return: The sum of the loss functions.
        :rtype: LabelTensor
        """

        dataloader = self.trainer.train_dataloader
        condition_losses = []

        condition_idx = batch['condition']

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

>           condition_name = dataloader.condition_names[condition_id]
E           AttributeError: 'CombinedLoader' object has no attribute 'condition_names'

Additional context The installed packages to reproduce the error are:

Successfully installed Jinja2-3.1.2 MarkupSafe-2.1.3 PyYAML-6.0.1 aiohttp-3.8.6 aiosignal-1.3.1 
anyio-3.7.1 arrow-1.2.3 async-timeout-4.0.3 asynctest-0.13.0 attrs-23.1.0 beautifulsoup4-4.12.2 
blessed-1.20.0 boto3-1.28.79 botocore-1.31.79 certifi-2023.7.22 charset-normalizer-3.3.2 
click-8.1.7 coverage-7.2.7 croniter-1.3.15 cycler-0.11.0 dateutils-0.6.12 deepdiff-6.6.1 
exceptiongroup-1.1.3 fastapi-0.88.0 fonttools-4.38.0 frozenlist-1.3.3 fsspec-2023.1.0 h11-0.14.0 
idna-3.4 importlib-metadata-6.7.0 iniconfig-2.0.0 inquirer-2.10.1 itsdangerous-2.1.2 
jmespath-1.0.1 kiwisolver-1.4.5 lightning-1.9.5 lightning-cloud-0.5.50 lightning-utilities-0.9.0
 markdown-it-py-2.2.0 matplotlib-3.5.3 mdurl-0.1.2 multidict-6.0.4 numpy-1.21.6 ordered-set-4.1.0
 packaging-23.2 pillow-9.5.0 pina-mathlab-0.1 pluggy-1.2.0 psutil-5.9.6 pydantic-1.10.13 
pygments-2.16.1 pyjwt-2.8.0 pyparsing-3.1.1 pytest-7.4.3 pytest-cov-4.1.0 python-dateutil-2.8.2
 python-editor-1.0.4 python-multipart-0.0.6 pytorch-lightning-1.9.5 pytz-2023.3.post1 
readchar-4.0.5 requests-2.31.0 rich-13.6.0 s3transfer-0.7.0 six-1.16.0 sniffio-1.3.0 
soupsieve-2.4.1 starlette-0.22.0 starsessions-1.3.0 tomli-2.0.1 torch-1.13.1 
torchmetrics-0.11.4 tqdm-4.66.1 traitlets-5.9.0 typing-extensions-4.7.1 urllib3-1.26.18 
uvicorn-0.22.0 wcwidth-0.2.9 websocket-client-1.6.1 websockets-11.0.3 yarl-1.9.2 zipp-3.15.0
ndem0 commented 11 months ago

fix in #215