Skip to content

Commit

Permalink
Merge pull request #283 from lnccbrown/280-pin-numpy-version
Browse files Browse the repository at this point in the history
Bumped PyMC version and limited numpy version
  • Loading branch information
digicosmos86 authored Oct 10, 2023
2 parents c16cedc + d036daf commit d0fa9ca
Show file tree
Hide file tree
Showing 17 changed files with 34 additions and 51 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build_and_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.10", "3.11"]

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: 3.9
python-version: 3.11

- name: Install poetry
uses: snok/install-poetry@v1
Expand All @@ -82,7 +82,7 @@ jobs:
id: cache
with:
path: .venv
key: venv-${{ runner.os }}-3.9-${{ hashFiles('**/pyproject.toml') }}
key: venv-${{ runner.os }}-3.11-${{ hashFiles('**/pyproject.toml') }}

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: "3.9"
python-version: "3.11"

- name: Install poetry
uses: snok/install-poetry@v1
Expand All @@ -33,7 +33,7 @@ jobs:
id: cache
with:
path: .venv
key: venv-${{ runner.os }}-3.9-${{ hashFiles('**/pyproject.toml') }}
key: venv-${{ runner.os }}-3.11-${{ hashFiles('**/pyproject.toml') }}

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.10", "3.11"]

steps:
- uses: actions/checkout@v3
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ You will need optional dependencies to use JAX-based samplers and graph the mode
Please refer to our [installation guide](https://lnccbrown.github.io/HSSM/getting_started/installation/)
for more detailed instructions.

**Note**: Possible solutions to any issues with installations with hssm can be located [here](https://github.com/lnccbrown/HSSM/discussions). We recommend leveraging an environment manager with Python 3.9~3.11 to prevent any problems with dependencies during the installation process. Please note that hssm is tested for python 3.9, 3.10, 3.11. Use other python versions with caution.
**Note**: Possible solutions to any issues with installations with hssm can be located
[here](https://github.com/lnccbrown/HSSM/discussions). We recommend leveraging an
environment manager with Python 3.10~3.11 to prevent any problems with dependencies
during the installation process. Please note that hssm is tested for python 3.10,
3.11. As of HSSM v0.1.6, support for Python 3.9 is dropped. Use other python
versions with caution.

## Example

Expand Down
8 changes: 5 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ For more detailed guidance, please check out our [installation guide](getting_st

Possible solutions to any issues with installations with hssm can be located
[here](https://github.com/lnccbrown/HSSM/discussions). We recommend leveraging an
environment manager with Python 3.9~3.11 to prevent any problems with dependencies
during the installation process. Please note that hssm is tested for python 3.9, 3.10,
3.11. Use other python versions with caution.
environment manager with Python 3.10~3.11 to prevent any problems with dependencies
during the installation process. Please note that hssm is tested for python 3.10,
3.11. As of HSSM v0.1.6, support for Python 3.9 is dropped. Use other python
versions with caution.


### Setting global float type

Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ repository = "https://github.com/lnccbrown/HSSM"
keywords = ["HSSM", "sequential sampling models", "bayesian", "bayes", "mcmc"]

[tool.poetry.dependencies]
python = ">=3.9,<3.12"
pymc = ">=5.6.0,<5.7.0"
python = ">=3.10,<3.12"
pymc = ">=5.9.0"
scipy = "1.10.1"
arviz = "^0.14.0"
numpy = "^1.23.4"
numpy = ">=1.23.4,<1.26"
onnx = "^1.12.0"
jax = "^0.4.0"
jaxlib = "^0.4.0"
Expand Down
2 changes: 1 addition & 1 deletion src/hssm/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Config and ModelConfig classes that process configs."""


# This is necessary to enable forward looking
from __future__ import annotations

from copy import deepcopy
Expand Down
2 changes: 0 additions & 2 deletions src/hssm/distribution_utils/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
generation ops.
"""

from __future__ import annotations

import logging
from os import PathLike
from typing import Any, Callable, Iterable, Type
Expand Down
2 changes: 0 additions & 2 deletions src/hssm/distribution_utils/onnx/onnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
from onnx model files and wrapping jax log-likelihood functions in pytensor Ops.
"""

from __future__ import annotations

from os import PathLike
from typing import Callable

Expand Down
24 changes: 9 additions & 15 deletions src/hssm/hssm.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,25 @@
This file defines the entry class HSSM.
"""

from __future__ import annotations

import logging
from copy import deepcopy
from inspect import isclass
from os import PathLike
from pathlib import Path
from typing import TYPE_CHECKING, Any, Callable, Literal
from typing import Any, Callable, Literal

import arviz as az
import bambi as bmb
import numpy as np
import pandas as pd
import pymc as pm
import pytensor
from bambi.model_components import DistributionalComponent

from hssm.defaults import (
LoglikKind,
SupportedModels,
)
from hssm.distribution_utils import (
make_blackbox_op,
make_distribution,
Expand All @@ -39,18 +45,6 @@

from .config import Config, ModelConfig

if TYPE_CHECKING:
from os import PathLike

import arviz as az
import numpy as np
import pandas as pd

from hssm.defaults import (
LoglikKind,
SupportedModels,
)

_logger = logging.getLogger("hssm")


Expand Down
2 changes: 0 additions & 2 deletions src/hssm/likelihoods/analytical.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
https://gist.github.com/sammosummo/c1be633a74937efaca5215da776f194b.
"""

from __future__ import annotations

from typing import Type

import numpy as np
Expand Down
2 changes: 0 additions & 2 deletions src/hssm/likelihoods/blackbox.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Black box likelihoods written in Cython for "ddm" and "ddm_sdv" models."""

from __future__ import annotations

import numpy as np
from hddm_wfpt import wfpt

Expand Down
2 changes: 0 additions & 2 deletions src/hssm/param.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""The Param utility class."""

from __future__ import annotations

import logging
from typing import Any, Union, cast

Expand Down
2 changes: 0 additions & 2 deletions src/hssm/prior.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
3. The ability to shorten the output of bmb.Prior.
"""

from __future__ import annotations

from typing import Callable

import bambi as bmb
Expand Down
8 changes: 1 addition & 7 deletions src/hssm/simulator.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
"""Simulates data with basic ssm_simulators."""

from __future__ import annotations

from typing import TYPE_CHECKING

import numpy as np
import pandas as pd
from numpy.typing import ArrayLike
from ssms.basic_simulators.simulator import simulator
from ssms.config import model_config

if TYPE_CHECKING:
from numpy.typing import ArrayLike


def simulate_data(
model: str,
Expand Down
2 changes: 0 additions & 2 deletions src/hssm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
_parse_bambi().
"""

from __future__ import annotations

import logging
from copy import deepcopy
from typing import Any, Iterable, Literal, NewType
Expand Down
4 changes: 3 additions & 1 deletion tests/test_onnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ def fixture_path():
def onnx_session(fixture_path):
model_path = str(fixture_path / "angle.onnx")

return onnxruntime.InferenceSession(model_path, None)
return onnxruntime.InferenceSession(
model_path, None, providers=["CPUExecutionProvider"]
)


def test_interpret_onnx(onnx_session, fixture_path):
Expand Down

0 comments on commit d0fa9ca

Please sign in to comment.