Skip to content

Commit 796da44

Browse files
authored
fix(skore-hub-project): Use orjson to serialize payload, especially for nan (#2038)
```python from skrub import TableVectorizer, TextEncoder from sklearn.ensemble import HistGradientBoostingRegressor from sklearn.pipeline import make_pipeline from skrub.datasets import fetch_employee_salaries from skore import CrossValidationReport from skore import Project if not "hgbt_model_report" in globals(): datasets = fetch_employee_salaries() df, y = datasets.X, datasets.y model = make_pipeline( TableVectorizer(high_cardinality=TextEncoder()), HistGradientBoostingRegressor(), ) hgbt_model_report = CrossValidationReport( estimator=model, X=df, y=y, splitter=5, n_jobs=-1 ) project = Project("hub://<tenant>/<project>") project.put("hgbt_model_report", hgbt_model_report) ``` raises error while serializing the `TableReport` medias. ```python ValueError Traceback (most recent call last) Cell In[1], line 33 29 project = Project("<project>") 31 assert project.mode == "hub" ---> 33 project.put("hgbt_model_report", hgbt_model_report) [...] ValueError: Out of range float values are not JSON compliant: nan ```
1 parent b2d6933 commit 796da44

File tree

11 files changed

+29
-1
lines changed

11 files changed

+29
-1
lines changed

ci/requirements/skore-hub-project/python-3.10/scikit-learn-1.4/test-requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ numpy==2.2.6
127127
# skops
128128
# skore
129129
# skrub
130+
orjson==3.11.3
131+
# via skore-hub-project (skore-hub-project/pyproject.toml)
130132
packaging==25.0
131133
# via
132134
# altair

ci/requirements/skore-hub-project/python-3.10/scikit-learn-1.7/test-requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ numpy==2.2.6
127127
# skops
128128
# skore
129129
# skrub
130+
orjson==3.11.3
131+
# via skore-hub-project (skore-hub-project/pyproject.toml)
130132
packaging==25.0
131133
# via
132134
# altair

ci/requirements/skore-hub-project/python-3.11/scikit-learn-1.4/test-requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ numpy==2.3.2
124124
# skops
125125
# skore
126126
# skrub
127+
orjson==3.11.3
128+
# via skore-hub-project (skore-hub-project/pyproject.toml)
127129
packaging==25.0
128130
# via
129131
# altair

ci/requirements/skore-hub-project/python-3.11/scikit-learn-1.7/test-requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ numpy==2.3.2
124124
# skops
125125
# skore
126126
# skrub
127+
orjson==3.11.3
128+
# via skore-hub-project (skore-hub-project/pyproject.toml)
127129
packaging==25.0
128130
# via
129131
# altair

ci/requirements/skore-hub-project/python-3.12/scikit-learn-1.4/test-requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ numpy==2.3.2
124124
# skops
125125
# skore
126126
# skrub
127+
orjson==3.11.3
128+
# via skore-hub-project (skore-hub-project/pyproject.toml)
127129
packaging==25.0
128130
# via
129131
# altair

ci/requirements/skore-hub-project/python-3.12/scikit-learn-1.7/test-requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ numpy==2.3.2
124124
# skops
125125
# skore
126126
# skrub
127+
orjson==3.11.3
128+
# via skore-hub-project (skore-hub-project/pyproject.toml)
127129
packaging==25.0
128130
# via
129131
# altair

ci/requirements/skore-hub-project/python-3.13/scikit-learn-1.5/test-requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ numpy==2.3.2
124124
# skops
125125
# skore
126126
# skrub
127+
orjson==3.11.3
128+
# via skore-hub-project (skore-hub-project/pyproject.toml)
127129
packaging==25.0
128130
# via
129131
# altair

ci/requirements/skore-hub-project/python-3.13/scikit-learn-1.6/test-requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ numpy==2.3.2
124124
# skops
125125
# skore
126126
# skrub
127+
orjson==3.11.3
128+
# via skore-hub-project (skore-hub-project/pyproject.toml)
127129
packaging==25.0
128130
# via
129131
# altair

ci/requirements/skore-hub-project/python-3.13/scikit-learn-1.7/test-requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ numpy==2.3.2
124124
# skops
125125
# skore
126126
# skrub
127+
orjson==3.11.3
128+
# via skore-hub-project (skore-hub-project/pyproject.toml)
127129
packaging==25.0
128130
# via
129131
# altair

skore-hub-project/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ dependencies = [
88
"httpx",
99
"joblib",
1010
"matplotlib",
11+
"orjson",
1112
"pydantic",
1213
"rich",
1314
"scikit-learn",

0 commit comments

Comments
 (0)