Skip to content

Commit 1908d51

Browse files
author
SamoraHunter
committed
bump to python 3.12.3, deprecated knn gpu because of simsig dependency. minor changes and refactoring.
1 parent ee48cbc commit 1908d51

File tree

12 files changed

+270
-173
lines changed

12 files changed

+270
-173
lines changed

.github/workflows/docs.yml

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,42 @@ jobs:
2323
# Build job: builds the documentation and uploads it as an artifact.
2424
build:
2525
runs-on: ubuntu-latest
26+
# Set ENV vars at the job level to be inherited by all steps, including actions
27+
env:
28+
NODE_EXTRA_CA_CERTS: /etc/ssl/certs/ca-certificates.crt
29+
SSL_CERT_FILE: /etc/ssl/certs/ca-certificates.crt
30+
REQUESTS_CA_BUNDLE: /etc/ssl/certs/ca-certificates.crt
31+
2632
steps:
2733
- name: Checkout repository
2834
uses: actions/checkout@v4
2935

36+
# Install Act dependencies FIRST (before any apt-get commands)
37+
- name: Install Act dependencies
38+
if: ${{ env.ACT }}
39+
run: |
40+
# Ensure apt-get is available and install sudo for 'act' environments
41+
if ! command -v apt-get &> /dev/null; then
42+
echo "apt-get not found, cannot proceed"
43+
exit 1
44+
fi
45+
# Install apt-utils first to avoid debconf warnings, then sudo
46+
DEBIAN_FRONTEND=noninteractive apt-get update && \
47+
DEBIAN_FRONTEND=noninteractive apt-get install -y apt-utils sudo
48+
49+
- name: Install Runner Dependencies & Configure CA
50+
run: |
51+
sudo apt-get update
52+
# Install lsb-release, Node.js, and ca-certificates all at once
53+
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y lsb-release nodejs ca-certificates
54+
55+
# Trust your mounted certificate (from the act command)
56+
sudo update-ca-certificates
57+
3058
- name: Set up Python
3159
uses: actions/setup-python@v5
3260
with:
33-
python-version: '3.10'
61+
python-version: '3.12.3'
3462
cache: 'pip'
3563

3664
- name: Install dependencies
@@ -52,7 +80,21 @@ jobs:
5280
name: github-pages
5381
url: ${{ steps.deployment.outputs.page_url }}
5482
runs-on: ubuntu-latest
83+
env:
84+
NODE_EXTRA_CA_CERTS: /etc/ssl/certs/ca-certificates.crt
85+
5586
steps:
87+
- name: Install Act dependencies
88+
if: ${{ env.ACT }}
89+
run: |
90+
apt-get update && apt-get install -y sudo
91+
92+
- name: Install Runner Dependencies & Configure CA
93+
run: |
94+
sudo apt-get update
95+
sudo apt-get install -y nodejs ca-certificates
96+
sudo update-ca-certificates
97+
5698
- name: Deploy to GitHub Pages
5799
id: deployment
58100
uses: actions/deploy-pages@v4
@@ -62,7 +104,21 @@ jobs:
62104
needs: build
63105
if: ${{ vars.IS_GITEA == 'true' }}
64106
runs-on: ubuntu-latest
107+
env:
108+
NODE_EXTRA_CA_CERTS: /etc/ssl/certs/ca-certificates.crt
109+
65110
steps:
111+
- name: Install Act dependencies
112+
if: ${{ env.ACT }}
113+
run: |
114+
apt-get update && apt-get install -y sudo
115+
116+
- name: Install Runner Dependencies & Configure CA
117+
run: |
118+
sudo apt-get update
119+
sudo apt-get install -y nodejs ca-certificates
120+
sudo update-ca-certificates
121+
66122
- name: Download artifact
67123
uses: actions/download-artifact@v4
68124
with:

.github/workflows/notebook-test.yml

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ on: [push, pull_request]
55
jobs:
66
test:
77
runs-on: ubuntu-latest
8+
9+
10+
env:
11+
NODE_EXTRA_CA_CERTS: /etc/ssl/certs/ca-certificates.crt
12+
SSL_CERT_FILE: /etc/ssl/certs/ca-certificates.crt
13+
REQUESTS_CA_BUNDLE: /etc/ssl/certs/ca-certificates.crt
814

915
steps:
1016
- name: Check out repository
@@ -25,12 +31,15 @@ jobs:
2531
- name: Install Act dependencies
2632
if: ${{ env.ACT }}
2733
run: |
28-
apt-get update && apt-get install sudo -y
34+
apt-get update && apt-get install -y sudo
2935
30-
- name: Install CA cert tools and trust internal CA
36+
- name: Install Runner Dependencies & Configure CA
3137
run: |
3238
sudo apt-get update
33-
sudo apt-get install -y ca-certificates
39+
# Install Node.js (for JS-based actions) & ca-certificates
40+
sudo apt-get install -y nodejs ca-certificates
41+
42+
# This trusts your mounted certificate (from the act command)
3443
sudo update-ca-certificates
3544
3645
- name: Install ping utility
@@ -40,7 +49,6 @@ jobs:
4049
4150
- name: Set timezone to UTC
4251
run: |
43-
# Use sudo for all commands to ensure permissions in all runner environments
4452
sudo ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime
4553
echo "Etc/UTC" | sudo tee /etc/timezone
4654
sudo apt-get update
@@ -57,37 +65,37 @@ jobs:
5765
sudo apt-get update
5866
sudo apt-get install -y default-jre
5967
60-
- name: Install Python 3.10, Git, and set CA environment
68+
- name: Install build dependencies
69+
run: |
70+
sudo apt-get update
71+
sudo apt-get install -y build-essential
72+
73+
- name: Install Python 3.12 and Git
6174
run: |
6275
sudo apt-get update
6376
sudo apt-get install -y lsb-release software-properties-common gnupg curl git
6477
65-
# Properly and securely add the GPG key for the deadsnakes PPA
78+
# --- THIS IS THE GPG KEY FIX ---
79+
6680
sudo gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys BA6932366A755776
6781
sudo gpg --export BA6932366A755776 | sudo gpg --dearmor -o /usr/share/keyrings/deadsnakes-archive-keyring.gpg
82+
# --- END FIX ---
6883
69-
# Add the PPA repository, signed by the new key
7084
echo "deb [signed-by=/usr/share/keyrings/deadsnakes-archive-keyring.gpg] http://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/deadsnakes-ppa.list
7185
7286
sudo apt-get update
73-
sudo apt-get install -y python3.10 python3.10-venv python3.10-distutils
87+
sudo apt-get install -y python3.12 python3.12-venv python3.12-dev
7488
75-
# Set Python 3.10 as default using symbolic links
76-
sudo ln -sf /usr/bin/python3.10 /usr/local/bin/python
77-
sudo ln -sf /usr/bin/python3.10 /usr/local/bin/python3
89+
sudo ln -sf /usr/bin/python3.12 /usr/local/bin/python
90+
sudo ln -sf /usr/bin/python3.12 /usr/local/bin/python3
7891
7992
python --version
80-
81-
# Set the certificate path for all subsequent steps in the job
82-
echo "SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt" >> $GITHUB_ENV
83-
echo "REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt" >> $GITHUB_ENV
8493
8594
- name: Setup ML project
8695
run: |
8796
cd $GITHUB_WORKSPACE
88-
# Make install.sh executable if it isn't already
8997
chmod +x install.sh
90-
# Run the installation script
98+
# This 'pip' command will now inherit the job-level 'REQUESTS_CA_BUNDLE'
9199
./install.sh
92100
93101
- name: Debug virtual environment

config_single_run.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ models:
4545
H2O_XGBoost_class: true
4646
H2O_StackedEnsemble_class: false
4747
H2O_GAM_class: true
48+
knn__gpu_wrapper_class: false
4849

4950
# This section defines a single set of parameters for a standalone run.
5051
run_params:

ml_grid/model_classes/knn_gpu_classifier_class.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class for the KNNWrapper (GPU-accelerated KNN). It provides parameter spaces for
1111
import pandas as pd
1212
from skopt.space import Categorical, Integer
1313

14-
from ml_grid.model_classes.knn_wrapper_class import KNNWrapper
14+
#from ml_grid.model_classes.knn_wrapper_class import KNNWrapper
1515
from ml_grid.util import param_space
1616
from ml_grid.util.global_params import global_parameters
1717

@@ -45,7 +45,7 @@ def __init__(
4545
self.y: Optional[pd.Series] = y
4646

4747
# Initialize KNNWrapper for GPU support
48-
self.algorithm_implementation: KNNWrapper = KNNWrapper()
48+
#self.algorithm_implementation: KNNWrapper = KNNWrapper()
4949
self.method_name: str = "knn__gpu"
5050

5151
# Define the parameter vector space

ml_grid/pipeline/hyperparameter_search.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
)
2323
from ml_grid.model_classes.H2OXGBoostClassifier import H2OXGBoostClassifier
2424
from ml_grid.model_classes.keras_classifier_class import KerasClassifierClass
25-
from ml_grid.model_classes.knn_wrapper_class import KNNWrapper
25+
#from ml_grid.model_classes.knn_wrapper_class import KNNWrapper
2626
from ml_grid.model_classes.NeuralNetworkKerasClassifier import NeuralNetworkClassifier
2727
from ml_grid.util.global_params import global_parameters
2828
from ml_grid.util.validate_parameters import validate_parameters_helper
@@ -99,7 +99,7 @@ def __init__(
9999

100100
# Custom wrappers that might not be recognized by is_classifier
101101
custom_classifier_types = (
102-
KNNWrapper,
102+
#KNNWrapper,
103103
H2OAutoMLClassifier,
104104
H2OGBMClassifier,
105105
H2ODRFClassifier,
@@ -192,7 +192,7 @@ def run_search(self, X_train: pd.DataFrame, y_train: pd.Series) -> BaseEstimator
192192

193193
# Also limit n_jobs for Bayesian search and other specific wrappers to avoid issues.
194194
is_single_threaded_search = isinstance(
195-
self.algorithm, (KNNWrapper, KerasClassifierClass, NeuralNetworkClassifier)
195+
self.algorithm, ( KerasClassifierClass, NeuralNetworkClassifier) #KNNWrapper,
196196
)
197197

198198
if is_h2o_model or is_single_threaded_search or bayessearch:

ml_grid/pipeline/model_class_list.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
)
3636
from ml_grid.model_classes.h2o_xgboost_classifier_class import H2O_XGBoost_class
3737
from ml_grid.model_classes.knn_classifier_class import KNeighborsClassifierClass
38-
from ml_grid.model_classes.knn_gpu_classifier_class import KNNGpuWrapperClass
38+
#from ml_grid.model_classes.knn_gpu_classifier_class import KNNGpuWrapperClass
3939
from ml_grid.model_classes.keras_classifier_class import KerasClassifierClass
4040
from ml_grid.model_classes.light_gbm_class import LightGBMClassifierWrapper
4141
from ml_grid.model_classes.logistic_regression_class import LogisticRegressionClass
@@ -78,7 +78,7 @@
7878
"NeuralNetworkClassifier_class": NeuralNetworkClassifier_class, # Corrected mapping
7979
# GPU specific
8080
"KerasClassifierClass": KerasClassifierClass,
81-
"KNNGpuWrapperClass": KNNGpuWrapperClass,
81+
#"KNNGpuWrapperClass": KNNGpuWrapperClass, #deprecated by python 3.12 and simsig dependency
8282
# H2O Models
8383
"H2O_class": H2OAutoMLClass, # Alias for AutoML
8484
"H2OAutoMLClass": H2OAutoMLClass,
@@ -147,7 +147,7 @@ def get_model_class_list(ml_grid_object: pipe) -> List[Any]:
147147
"LightGBMClassifierWrapper": True,
148148
"AdaBoostClassifierClass": True,
149149
"KerasClassifierClass": gpu_available,
150-
"KNNGpuWrapperClass": gpu_available,
150+
#"KNNGpuWrapperClass": gpu_available, #deprecated
151151
"NeuralNetworkClassifier_class": False, # NNI based,
152152
"TabTransformerClass": False, # PyTorch based
153153
"H2OAutoMLClass": False, # H2O AutoML
@@ -169,7 +169,7 @@ def get_model_class_list(ml_grid_object: pipe) -> List[Any]:
169169
)
170170
models_to_disable = [
171171
"KerasClassifierClass",
172-
"KNNGpuWrapperClass",
172+
#"KNNGpuWrapperClass",
173173
"H2OAutoMLClass",
174174
"H2O_GBM_class",
175175
"H2O_DRF_class",

ml_grid/util/validate_parameters.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
from sklearn.neighbors import KNeighborsClassifier
77
from xgboost import XGBClassifier
88

9-
from ml_grid.model_classes.knn_gpu_classifier_class import KNNGpuWrapperClass
10-
from ml_grid.model_classes.knn_wrapper_class import KNNWrapper
9+
#from ml_grid.model_classes.knn_gpu_classifier_class import KNNGpuWrapperClass
10+
#from ml_grid.model_classes.knn_wrapper_class import KNNWrapper
1111

1212

1313
def validate_knn_parameters(
@@ -108,17 +108,17 @@ def validate_parameters_helper(
108108

109109
return parameters
110110

111-
elif type(algorithm_implementation) == KNNWrapper:
111+
# elif type(algorithm_implementation) == KNNWrapper:
112112

113-
parameters = validate_knn_parameters(parameters, ml_grid_object)
113+
# parameters = validate_knn_parameters(parameters, ml_grid_object)
114114

115-
return parameters
115+
# return parameters
116116

117-
elif isinstance(algorithm_implementation, KNNGpuWrapperClass):
117+
# elif isinstance(algorithm_implementation, KNNGpuWrapperClass):
118118

119-
parameters = validate_knn_parameters(parameters, ml_grid_object)
119+
# parameters = validate_knn_parameters(parameters, ml_grid_object)
120120

121-
return parameters
121+
# return parameters
122122

123123
elif isinstance(algorithm_implementation, XGBClassifier):
124124
parameters = validate_XGB_parameters(parameters, ml_grid_object)

notebooks/unit_test_synthetic.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1498,7 +1498,7 @@
14981498
"name": "python",
14991499
"nbconvert_exporter": "python",
15001500
"pygments_lexer": "ipython3",
1501-
"version": "3.10.12"
1501+
"version": "3.12.3"
15021502
}
15031503
},
15041504
"nbformat": 4,

0 commit comments

Comments
 (0)