From 1fdd728af44717b4dcef8e496f9b51859bb4e365 Mon Sep 17 00:00:00 2001 From: Michael Osthege Date: Wed, 4 Jan 2023 13:20:11 +0100 Subject: [PATCH 1/3] Bump PyTensor to 2.9.1 --- conda-envs/environment-dev.yml | 2 +- conda-envs/environment-test.yml | 2 +- conda-envs/windows-environment-dev.yml | 2 +- conda-envs/windows-environment-test.yml | 2 +- requirements-dev.txt | 2 +- requirements.txt | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/conda-envs/environment-dev.yml b/conda-envs/environment-dev.yml index 6f40d2badf..44c5d73ecc 100644 --- a/conda-envs/environment-dev.yml +++ b/conda-envs/environment-dev.yml @@ -14,7 +14,7 @@ dependencies: - numpy>=1.15.0 - pandas>=0.24.0 - pip -- pytensor=2.8.11 +- pytensor=2.9.1 - python-graphviz - networkx - scipy>=1.4.1 diff --git a/conda-envs/environment-test.yml b/conda-envs/environment-test.yml index d1603b5720..b70ad4cee3 100644 --- a/conda-envs/environment-test.yml +++ b/conda-envs/environment-test.yml @@ -17,7 +17,7 @@ dependencies: - numpy>=1.15.0 - pandas>=0.24.0 - pip -- pytensor=2.8.11 +- pytensor=2.9.1 - python-graphviz - networkx - scipy>=1.4.1 diff --git a/conda-envs/windows-environment-dev.yml b/conda-envs/windows-environment-dev.yml index 319a070105..5b6e5749e5 100644 --- a/conda-envs/windows-environment-dev.yml +++ b/conda-envs/windows-environment-dev.yml @@ -14,7 +14,7 @@ dependencies: - numpy>=1.15.0 - pandas>=0.24.0 - pip -- pytensor=2.8.11 +- pytensor=2.9.1 - python-graphviz - networkx - scipy>=1.4.1 diff --git a/conda-envs/windows-environment-test.yml b/conda-envs/windows-environment-test.yml index 067e3f1008..fd88e054ce 100644 --- a/conda-envs/windows-environment-test.yml +++ b/conda-envs/windows-environment-test.yml @@ -17,7 +17,7 @@ dependencies: - numpy>=1.15.0 - pandas>=0.24.0 - pip -- pytensor=2.8.11 +- pytensor=2.9.1 - python-graphviz - networkx - scipy>=1.4.1 diff --git a/requirements-dev.txt b/requirements-dev.txt index c1ef9b70e8..4d3ba57f9b 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -17,7 +17,7 @@ numpydoc pandas>=0.24.0 polyagamma pre-commit>=2.8.0 -pytensor==2.8.11 +pytensor==2.9.1 pytest-cov>=2.5 pytest>=3.0 scipy>=1.4.1 diff --git a/requirements.txt b/requirements.txt index cc6e6afc17..e2e0ae3944 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,6 +4,6 @@ cloudpickle fastprogress>=0.2.0 numpy>=1.15.0 pandas>=0.24.0 -pytensor==2.8.11 +pytensor==2.9.1 scipy>=1.4.1 typing-extensions>=3.7.4 From e4b8b942e7ee6e772c5df739989199651ae08e92 Mon Sep 17 00:00:00 2001 From: Michael Osthege Date: Thu, 12 Jan 2023 15:13:19 +0100 Subject: [PATCH 2/3] Allow installation from `.conda` artifacts --- .github/workflows/pre-commit.yml | 2 +- .github/workflows/tests.yml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index b6379e2b09..8cb0c909f2 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -52,7 +52,7 @@ jobs: environment-file: conda-envs/environment-test.yml python-version: 3.9 use-mamba: true - use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! + use-only-tar-bz2: false # IMPORTANT: This may break caching of conda packages! See https://github.com/conda-incubator/setup-miniconda/issues/267 - name: Install-pymc and mypy dependencies run: | conda activate pymc-test diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8e08464379..443e3e376b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -140,7 +140,7 @@ jobs: environment-file: conda-envs/environment-test.yml python-version: ${{matrix.python-version}} use-mamba: true - use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! + use-only-tar-bz2: false # IMPORTANT: This may break caching of conda packages! See https://github.com/conda-incubator/setup-miniconda/issues/267 - name: Install-pymc run: | conda activate pymc-test @@ -211,7 +211,7 @@ jobs: environment-file: conda-envs/windows-environment-test.yml python-version: ${{matrix.python-version}} use-mamba: true - use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! + use-only-tar-bz2: false # IMPORTANT: This may break caching of conda packages! See https://github.com/conda-incubator/setup-miniconda/issues/267 - name: Install-pymc run: | conda activate pymc-test @@ -290,7 +290,7 @@ jobs: environment-file: conda-envs/environment-test.yml python-version: ${{matrix.python-version}} use-mamba: true - use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! + use-only-tar-bz2: false # IMPORTANT: This may break caching of conda packages! See https://github.com/conda-incubator/setup-miniconda/issues/267 - name: Install pymc run: | conda activate pymc-test @@ -355,7 +355,7 @@ jobs: environment-file: conda-envs/environment-test.yml python-version: ${{matrix.python-version}} use-mamba: true - use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! + use-only-tar-bz2: false # IMPORTANT: This may break caching of conda packages! See https://github.com/conda-incubator/setup-miniconda/issues/267 - name: Install pymc run: | conda activate pymc-test @@ -425,7 +425,7 @@ jobs: environment-file: conda-envs/windows-environment-test.yml python-version: ${{matrix.python-version}} use-mamba: true - use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! + use-only-tar-bz2: false # IMPORTANT: This may break caching of conda packages! See https://github.com/conda-incubator/setup-miniconda/issues/267 - name: Install-pymc run: | conda activate pymc-test From e0622371f318c208277a25706b605f25350b4fbe Mon Sep 17 00:00:00 2001 From: Michael Osthege Date: Thu, 12 Jan 2023 16:40:54 +0100 Subject: [PATCH 3/3] Workaround type issues in `shape_utils` Caused by https://github.com/pymc-devs/pytensor/issues/193 --- pymc/distributions/shape_utils.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/pymc/distributions/shape_utils.py b/pymc/distributions/shape_utils.py index 759c4cc15d..26dfc1a85e 100644 --- a/pymc/distributions/shape_utils.py +++ b/pymc/distributions/shape_utils.py @@ -740,14 +740,15 @@ def get_support_shape( observed.shape[i] - support_shape_offset[i] for i in np.arange(-ndim_supp, 0) ] - # We did not learn anything - if inferred_support_shape is None and support_shape is None: - return None - # Only source of information was the originally provided support_shape - elif inferred_support_shape is None: - inferred_support_shape = support_shape - # There were two sources of support_shape, make sure they are consistent + if inferred_support_shape is None: + if support_shape is not None: + # Only source of information was the originally provided support_shape + inferred_support_shape = support_shape + else: + # We did not learn anything + return None elif support_shape is not None: + # There were two sources of support_shape, make sure they are consistent inferred_support_shape = [ cast( Variable, @@ -758,6 +759,8 @@ def get_support_shape( for inferred, explicit in zip(inferred_support_shape, support_shape) ] + # Workaround https://github.com/pymc-devs/pytensor/issues/193 typing bug in stack signature + inferred_support_shape = cast(Sequence[TensorVariable], inferred_support_shape) return at.stack(inferred_support_shape)