Skip to content
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

Dump version v0.0.5 #23

Merged
merged 9 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
38 changes: 35 additions & 3 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,45 @@ name: Test package
on: [pull_request]

jobs:
build-ubuntu-latest-full:
runs-on: ubuntu-latest
strategy:
max-parallel: 6
matrix:
python-version: [3.8]
test-tool: [pylint, flake8]

steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade setuptools
pip install -r requirements.txt
- name: Test with ${{ matrix.test-tool }}
run: |
pip install ${{ matrix.test-tool }}
tests/run_tests.sh ${{ matrix.test-tool }}
- name: Lint with flake8
run: |
pip install flake8
tests/run_tests.sh flake8
- name: Test with pytest
run: |
pip install pytest
tests/run_tests.sh pytest

build-ubuntu-latest:
runs-on: ubuntu-latest
strategy:
max-parallel: 6
matrix:
python-version: [3.7, 3.8, 3.9]
test-tool: [pylint, flake8, pytest]
python-version: [3.8, 3.9, 3.10.x]
test-tool: [pytest]

steps:
- uses: actions/checkout@v1
Expand Down Expand Up @@ -40,7 +72,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: [3.8, 3.9, 3.10.x]
test-tool: [pytest]

steps:
Expand Down
8 changes: 7 additions & 1 deletion hipe4ml_converter/h4ml_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,18 @@ def convert_model_onnx(self, input_shape, target_opset=13):

training_columns = self.model_handler.get_training_columns()
n_features = len(training_columns)
feature_names = [f"f{i_feat}" for i_feat in range(n_features)]
model = self.model_handler.get_original_model()
feature_names = [f"f{i_feat}" for i_feat in range(n_features)]
model.get_booster().feature_names = feature_names

self.model_onnx = onnxmltools.convert.convert_xgboost(
model, target_opset=target_opset,
initial_types=[("input", FloatTensorType(shape=[input_shape, n_features]))]
)

# restore original names
model.get_booster().feature_names = list(training_columns)

return self.model_onnx

def convert_model_hummingbird(self, backend, input_shape=None):
Expand Down Expand Up @@ -97,6 +100,9 @@ def convert_model_hummingbird(self, backend, input_shape=None):
else:
self.model_hummingbird = ml.convert(model, backend, extra_config={"n_features":n_features})

# restore original names
model.get_booster().feature_names = list(training_columns)

return self.model_hummingbird

def dump_model_onnx(self, filename):
Expand Down
13 changes: 6 additions & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
psutil
dutil
prophet==1.0.1
hipe4ml>=0.0.14
torch>=1.6.0
hipe4ml>=0.0.15
torch>=1.7.0
scikit-learn>=0.21.3
onnxconverter-common>=1.9.0
onnxconverter-common>=1.13.0
skl2onnx>=1.12.0
onnxmltools>=1.11.1
onnxmltools>=1.6.0,<=1.11.0
onnxruntime>=1.12.0
lightgbm>=2.2
hummingbird_ml[extra]==0.4.2
lightgbm>=2.2,<=3.3.5
hummingbird_ml[extra]>=0.4.9
18 changes: 9 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def __call__(self):
name="hipe4ml_converter",

# LAST-TAG is a placeholder. Automatically replaced at deploy time with the right tag
version="0.0.4",
version="0.0.5",
description="Minimal heavy ion physics environment for Machine Learning",
url="https://github.com/hipe4ml/hipe4ml_converter",
author="hipe4ml-developers",
Expand All @@ -68,9 +68,9 @@ def __call__(self):
"Intended Audience :: Developers",
"Topic :: Scientific/Engineering :: Physics",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9"
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10"
],

# What does your project relate to?
Expand All @@ -84,13 +84,13 @@ def __call__(self):
# installed. For an analysis of "install_requires" vs pip's requirements files see:
# https://packaging.python.org/en/latest/requirements.html
install_requires=[
"psutil", "dutil", "prophet==1.0.1", "pyarrow>=5.0.0", "hipe4ml>=0.0.14",
"ipython>=7.16.1", "jedi==0.17.2", "torch>=1.6.0",
"scikit-learn>=0.21.3", "onnxconverter-common>=1.9.0",
"skl2onnx>=1.12.0", "onnxmltools>=1.11.1", "onnxruntime>=1.12.0",
"lightgbm>=2.2", "hummingbird_ml[extra]==0.4.2"
"psutil", "dutil", "pyarrow>=5.0.0", "hipe4ml>=0.0.15",
"ipython>=7.16.1", "jedi==0.17.2", "torch>=1.7.0",
"scikit-learn>=0.21.3", "onnxconverter-common>=1.13.0",
"skl2onnx>=1.12.0", "onnxmltools>=1.6.0,<=1.11.0", "onnxruntime>=1.12.0",
"lightgbm>=2.2,<=3.3.5", "hummingbird_ml[extra]>=0.4.9"
],
python_requires=">=3.7",
python_requires=">=3.8",

# List additional groups of dependencies here (e.g. development dependencies). You can install
# these using the following syntax, for example:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_convert_model_onnx():
Test the conversion to onnx
"""
assert isinstance(model_converter.convert_model_onnx(1),
onnx_ml_pb2.ModelProto)
onnx_ml_pb2.ModelProto) # pylint: disable=no-member


def test_dump_model_onnx():
Expand Down
Loading