Can't upload a model

Now I’m creating a model on my laptop, then trying to download it.

I keep getting variants of this error message:

Running pip… Toggle ‘Show advanced logs’ in order to see more details

downloading data…

/context/data/X_train.parquet: download from https:crunchdao–competition–production.s3-accelerate.amazonaws.com/data-releases/146/X_train.parquet (204327238 bytes)

/context/data/y_train.parquet: download from https:crunchdao–competition–production.s3-accelerate.amazonaws.com/data-releases/146/y_train.parquet (61003 bytes)

/context/data/X_test.parquet: download from https:crunchdao–competition–production.s3-accelerate.amazonaws.com/data-releases/146/X_test.parquet (203819007 bytes)

downloading model…

/context/code/resources/model.joblib: download from https:crunchdao–competition–production.s3-accelerate.amazonaws.com/models/30028/model.joblib (144472 bytes)

starting unstructured loop…

executing - command=infer

infer: unknown parameter: comparison_support

infer: unknown parameter: model

infer: unknown parameter: N_Datasets

Loading model from /context/code/resources

Traceback (most recent call last):

File “/usr/local/lib/python3.10/contextlib.py”, line 79, in inner

return func(\*args, \*\*kwds)

File “/context/venv/lib/python3.10/site-packages/crunch/cli.py”, line 799, in cloud_executor

executor.start()

File “/context/venv/lib/python3.10/site-packages/crunch/runner/cloud_executor.py”, line 230, in start

prediction = self.process_unstructured()

File “/context/venv/lib/python3.10/site-packages/crunch/runner/cloud_executor.py”, line 486, in process_unstructured

return utils.smart_call(

File “/context/venv/lib/python3.10/site-packages/crunch/utils.py”, line 270, in smart_call

return function(\*\*arguments)

File “/context/scoring/runner.py”, line 113, in infer

wrapper = GeneratorWrapper(

File “/context/venv/lib/python3.10/site-packages/crunch/container.py”, line 168, in _init_

if next(consumer) is not None:

File “/context/code/main.py”, line 750, in infer

model = joblib.load(os.path.join(model_directory_path, 'model.joblib'))

File “/context/venv/lib/python3.10/site-packages/joblib/numpy_pickle.py”, line 749, in load

obj = \_unpickle(

File “/context/venv/lib/python3.10/site-packages/joblib/numpy_pickle.py”, line 626, in _unpickle

obj = unpickler.load()

File “/usr/local/lib/python3.10/pickle.py”, line 1213, in load

dispatch\[key\[0\]\](self)

File “/context/venv/lib/python3.10/site-packages/joblib/numpy_pickle.py”, line 462, in load_build

\_array_payload = array_wrapper.read(self, self.ensure_native_byte_order)

File “/context/venv/lib/python3.10/site-packages/joblib/numpy_pickle.py”, line 284, in read

array = self.read_array(unpickler, ensure_native_byte_order)

File “/context/venv/lib/python3.10/site-packages/joblib/numpy_pickle.py”, line 175, in read_array

array = pickle.load(unpickler.file_handle)

File “/context/venv/lib/python3.10/site-packages/numpy/random/_pickle.py”, line 34, in __bit_generator_ctor

raise ValueError(str(bit_generator_name) + ' is not a known '

ValueError: <class ‘numpy.random._mt19937.MT19937’> is not a known BitGenerator module.

command not exited correctly: 1

trace reported

The model I’m trying to download was created using sklearn.ensemble GradientBoostingClassifier

AIs suggest this is related to initializing the random number generator; gradientboostingclassifier does have a random_state argument. BUt I’m initializing it to 42; and still see the problem. Do I need a more sophisticated initialization?

Thanks for any help.

I can see in the logs that it use the already installed numpy==1.26.4, what version are you using?

Maybe it is a good idea to use numpy>=2 which can be done using version specifiers.

Modify your numpy import to:

import numpy as np # >=2

(yes the comment is important)

I am using np ‘2.3.2’. It seems likely that part of the problem is what I have in my .venv; (but it’s not clear what)

Does a pip freeze helps?

I did a pip freeze; but how does that information get communicated to the server? (I”m running a notebook)

It does! But only if you are using the CLI to submit, not via the website.
More over, it only “works” for a few libraries.

Please just use the version specifiers for your simple use-case.

import numpy as np # ==2.3.2