Cannot run C4_W3_Lab_4_Github_Actions - fails

I can’t run the ungraded lab C4_W3_Lab_4_Github_Actions
It seems to be failing for any of the models provided with this error

ERROR test_clf.py - ValueError: node array from the pickle has an incompatible dtype:

69- expected: {‘names’: [‘left_child’, ‘right_child’, ‘feature’, ‘threshold’, ‘impurity’, ‘n_node_samples’, ‘weighted_n_node_samples’, ‘missing_go_to_left’], ‘formats’: [‘<i8’, ‘<i8’, ‘<i8’, ‘<f8’, ‘<f8’, ‘<i8’, ‘<f8’, ‘u1’], ‘offsets’: [0, 8, 16, 24, 32, 40, 48, 56], ‘itemsize’: 64}

70- got : [(‘left_child’, ‘<i8’), (‘right_child’, ‘<i8’), (‘feature’, ‘<i8’), (‘threshold’, ‘<f8’), (‘impurity’, ‘<f8’), (‘n_node_samples’, ‘<i8’), (‘weighted_n_node_samples’, ‘<f8’)]

i am also facing the same problem. Let me know if you have fixed the problem.

@Isaak_Kamau any suggestion on this problem please.

No, I’m still seeing the same issue.
I also saw a warning “InconsistentVersionWarning: Trying to unpickle estimator StandardScaler from version 0.24.2 when using version 1.3.0”
So I tried playing around with the versions in the requirements.txt, but it didn’t help.

@isaak_kamau Can you please look into this matter. Or forward this to someone who can assist us? its been 1 week but we didn’t get any help.

Hello @Waliur_Rahman
Apologies for the delay!
Please give me some hours I will go through the lab.

Thank you

In the meantime you can try to load the model using joblib instead of pickle

import joblib
model = joblib.load('name_of_the_model.pkl')

Please let me know if the error is still there @Waliur_Rahman @rahulmen

Hello,

I still have the same problem despite using Joblib to load the model

Hello @Chikwado
Please share your error messages

Hello @Isaak_Kamau,

here is the error:
ERROR test_clf.py - ValueError: node array from the pickle has an incompatible dtype:

87- expected: {‘names’: [‘left_child’, ‘right_child’, ‘feature’, ‘threshold’, ‘impurity’, ‘n_node_samples’, ‘weighted_n_node_samples’, ‘missing_go_to_left’], ‘formats’: [‘<i8’, ‘<i8’, ‘<i8’, ‘<f8’, ‘<f8’, ‘<i8’, ‘<f8’, ‘u1’], ‘offsets’: [0, 8, 16, 24, 32, 40, 48, 56], ‘itemsize’: 64}

88- got : [(‘left_child’, ‘<i8’), (‘right_child’, ‘<i8’), (‘feature’, ‘<i8’), (‘threshold’, ‘<f8’), (‘impurity’, ‘<f8’), (‘n_node_samples’, ‘<i8’), (‘weighted_n_node_samples’, ‘<f8’)]

89!!! Interrupted: 1 error during collection !!!

90========================= 4 warnings, 1 error in 1.79s =========================

91Error: Process completed with exit code 2.

Hi @Isaak_Kamau, I had just followed your instruction to replace pickle with joblib in main.py and test_clf.py and reran the git action. Unforturnately, same input data error. (see below error from Git Action).
I think the test data may be faulty. Is there a way to amend the data to the format the program is expecting?

=========================== short test summary info ============================

86ERROR test_clf.py - ValueError: node array from the pickle has an incompatible dtype:

87- expected: {‘names’: [‘left_child’, ‘right_child’, ‘feature’, ‘threshold’, ‘impurity’, ‘n_node_samples’, ‘weighted_n_node_samples’, ‘missing_go_to_left’], ‘formats’: [‘<i8’, ‘<i8’, ‘<i8’, ‘<f8’, ‘<f8’, ‘<i8’, ‘<f8’, ‘u1’], ‘offsets’: [0, 8, 16, 24, 32, 40, 48, 56], ‘itemsize’: 64}

88- got : [(‘left_child’, ‘<i8’), (‘right_child’, ‘<i8’), (‘feature’, ‘<i8’), (‘threshold’, ‘<f8’), (‘impurity’, ‘<f8’), (‘n_node_samples’, ‘<i8’), (‘weighted_n_node_samples’, ‘<f8’)]

89!!! Interrupted: 1 error during collection !!!

90========================= 4 warnings, 1 error in 2.16s =========================

attached are the 2 py files modifed for your review and advise.

main (1).py (622 Bytes)
test_clf (1).py (408 Bytes)

Sincerely hope there would be a solution soon.

Dear MLOps Mentors, not sure if @Isaak_Kamau is available… can anyone of you help me so that I can progress my course on time. Much appreciate it,

Hi all, I managed to resolve the problem. For details, please refer to: