Skip to content

Add compatibility for python 3.12 #1632

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 44 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
d90fdd6
Add compatibility for python 3.12
Hartorn Nov 23, 2023
27fd450
Add constraints to tensorflow
Hartorn Nov 23, 2023
ed1a203
Regenerating pdm.lock
Nov 23, 2023
6f35330
Try to make install -G work with python 3.12
Hartorn Nov 23, 2023
6a81e65
Regenerating pdm.lock
Nov 23, 2023
15432f1
Remove some more deps
Hartorn Nov 23, 2023
17a7fb8
Regenerating pdm.lock
Nov 23, 2023
96c2b4b
Remove torchdata
Hartorn Nov 23, 2023
d3c2104
Regenerating pdm.lock
Nov 23, 2023
b82a513
Merge branch 'refs/heads/main' into feature/test-python3-12
kevinmessiaen Jun 11, 2024
1f20d9a
Updated pdm lock
kevinmessiaen Jun 11, 2024
2c76c49
Regenerating pdm.lock
Jun 11, 2024
5e6877d
Updated dependencies
kevinmessiaen Jun 11, 2024
62186f8
Merge remote-tracking branch 'origin/feature/test-python3-12' into fe…
kevinmessiaen Jun 11, 2024
474c6ba
Updated pdm lock
kevinmessiaen Jun 11, 2024
735c105
Updated pdm lock
kevinmessiaen Jun 11, 2024
a7b5e51
Merge branch 'main' into feature/test-python3-12
kevinmessiaen Jun 13, 2024
8f98dc4
Merge branch 'main' into feature/test-python3-12
kevinmessiaen Aug 30, 2024
8115310
Updated pdm lock
kevinmessiaen Aug 30, 2024
2984578
Make tensorflow dependencies optional due to incompatibility with win…
kevinmessiaen Aug 30, 2024
a86d5bf
Merge branch 'main' into feature/test-python3-12
kevinmessiaen Aug 30, 2024
967f7c8
Make tensorflow dependencies optional due to incompatibility with win…
kevinmessiaen Aug 30, 2024
1625f21
Do not install tensorflow on windows
kevinmessiaen Aug 30, 2024
980e445
Fixed Tensorflow model wrapping
kevinmessiaen Aug 30, 2024
e17fc76
Fixed assertions
kevinmessiaen Aug 30, 2024
89ef364
Fixed test for tensorflow due to keras 3
kevinmessiaen Aug 30, 2024
caff2fa
Merge branch 'main' into feature/test-python3-12
kevinmessiaen Aug 30, 2024
4faa512
Fixed assertion
kevinmessiaen Aug 30, 2024
60db06c
Merge remote-tracking branch 'origin/feature/test-python3-12' into fe…
kevinmessiaen Aug 30, 2024
0060f11
Upgrade to macos latest due to compatibility
kevinmessiaen Sep 2, 2024
76fa609
Updated compatibility table
kevinmessiaen Sep 2, 2024
4cda782
Updated compatibility table
kevinmessiaen Sep 2, 2024
9f4ff3c
Updated compatibility table
kevinmessiaen Sep 2, 2024
e201af6
Merge branch 'main' into feature/test-python3-12
kevinmessiaen Sep 2, 2024
306716f
Skip ensure backward compatibility
kevinmessiaen Sep 2, 2024
959568a
Merge remote-tracking branch 'origin/feature/test-python3-12' into fe…
kevinmessiaen Sep 2, 2024
3cd457c
Merge branch 'main' into feature/test-python3-12
kevinmessiaen Sep 3, 2024
dbf2c47
Fixed llm quickstart
kevinmessiaen Sep 3, 2024
d9e8bac
Updated matrix name on condition
kevinmessiaen Sep 3, 2024
d9157e4
Install libomp on macos
kevinmessiaen Sep 3, 2024
006a6b6
Fix Syntax Warning
henchaves Sep 3, 2024
a9b4ce0
Small change to test_root_log_level_default_warning
henchaves Sep 3, 2024
6b78c22
Commented breast cancer test
kevinmessiaen Sep 3, 2024
55c75d7
Skip xboost tests on macos
kevinmessiaen Sep 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .github/workflows/build-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
strategy:
fail-fast: false # Do not stop when any job fails
matrix:
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
os: [ubuntu-latest]
pydantic_v1: [false]
pandas_v1: [false]
Expand All @@ -72,7 +72,7 @@ jobs:
pandas_v1: false
langchain_minimal: false
- python-version: "3.10"
os: macos-12
os: macos-latest
pydantic_v1: false
pandas_v1: false
langchain_minimal: false
Expand Down Expand Up @@ -134,7 +134,14 @@ jobs:
run: |
df -h

- name: Install dependencies (Windows)
if: ${{ matrix.os == 'windows-2022' }}
run: |
pdm install -G :all --without tensorflow
pdm list

- name: Install dependencies
if: ${{ matrix.os != 'windows-2022' }}
run: |
pdm install -G :all
pdm list
Expand All @@ -144,10 +151,12 @@ jobs:
df -h

- name: Re-install lightgbm from sources for MacOS
if: ${{ matrix.os == 'macos-12' }}
if: ${{ matrix.os == 'macos-latest' }}
run: |
pdm run pip uninstall lightgbm -y
pdm run pip install --no-binary lightgbm lightgbm --config-settings=cmake.define.USE_OPENMP=OFF
brew install libomp

- name: Install pydantic v1
if: ${{ matrix.pydantic_v1 }}
run: |
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/notebooks/LLM_QA_IPCC.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@
},
"outputs": [],
"source": [
"results = scan(giskard_model, giskard_dataset, only=\"hallucination\")"
"results = scan(giskard_model, giskard_dataset, only=[\"hallucination\"])"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion giskard/models/automodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
("giskard.models.langchain", "LangchainModel"): [("langchain.chains.base", "Chain")],
("giskard.models.catboost", "CatboostModel"): [("catboost", "CatBoost")],
("giskard.models.pytorch", "PyTorchModel"): [("torch.nn", "Module")],
("giskard.models.tensorflow", "TensorFlowModel"): [("tensorflow", "Module")],
("giskard.models.tensorflow", "TensorFlowModel"): [("tensorflow", "Module"), ("keras", "Model")],
}


Expand Down
13 changes: 7 additions & 6 deletions giskard/testing/tests/statistic.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Statistical tests"""

from typing import Optional

import numbers
Expand Down Expand Up @@ -498,7 +499,7 @@ def test_nominal_association(
def test_cramer_v(
model: BaseModel, dataset: Dataset, slicing_function: SlicingFunction, threshold: float = 0.5
) -> TestResult:
"""Tests for nominal association between a dataset slice and the model predictions using Cramer's V.
r"""Tests for nominal association between a dataset slice and the model predictions using Cramer's V.

Cramer's V is a statistical measure used to assess the strength and nature of association between two
categorical variables. It is an extension of the chi-squared test for independence and takes into account the
Expand All @@ -513,7 +514,7 @@ def test_cramer_v(

.. math::

V = \sqrt{\\frac{\chi^2}{n \cdot \min(k-1, r-1)}}
V = \sqrt{\frac{\chi^2}{n \cdot \min(k-1, r-1)}}

where: :math:`\chi^2` is the chi-squared statistic for the two variables. n is the total number of observations.
:math:`k` is the
Expand Down Expand Up @@ -550,7 +551,7 @@ def test_cramer_v(
def test_mutual_information(
model: BaseModel, dataset: Dataset, slicing_function: SlicingFunction, threshold: float = 0.5
) -> TestResult:
"""Tests for nominal association between a dataset slice and the model predictions using Mutual Information.
r"""Tests for nominal association between a dataset slice and the model predictions using Mutual Information.

The mutual information statistical test is a measure used to quantify the degree of association between two
categorical variables. It assesses how much information about one variable can be gained from knowing the other
Expand All @@ -565,7 +566,7 @@ def test_mutual_information(

.. math::

I(X;Y) = \sum_{x \in X} \sum_{y \in Y} p(x, y) \cdot \log ( \\frac{p(x, y)}{p(x) \cdot p(y)})
I(X;Y) = \sum_{x \in X} \sum_{y \in Y} p(x, y) \cdot \log ( \frac{p(x, y)}{p(x) \cdot p(y)})

where: :math:`p(x,y)` is the joint probability mass function of variables :math:`X` and :math:`Y`. :math:`p(x)` and
:math:`p(y)` are the marginal probability mass functions of variables :math:`X` and :math:`Y` respectively.
Expand Down Expand Up @@ -601,7 +602,7 @@ def test_mutual_information(
def test_theil_u(
model: BaseModel, dataset: Dataset, slicing_function: SlicingFunction, threshold: float = 0.5
) -> TestResult:
"""Tests for nominal association between a dataset slice and the model predictions using Theil's U.
r"""Tests for nominal association between a dataset slice and the model predictions using Theil's U.

Theil's U statistical test for nominal association is a measure used to assess the strength and direction
of association between two categorical variables. It quantifies the inequality in the distribution of one variable
Expand All @@ -616,7 +617,7 @@ def test_theil_u(

.. math::

U = \\frac{H(x|y) - H(y|x)}{H(x)}
U = \frac{H(x|y) - H(y|x)}{H(x)}

where :math:`H(x|y)`, :math:`H(y|x)` are the conditional entropies of the two variables and :math:`H(x)` is the
entropy of the first variable.
Expand Down
Loading
Loading