Пример #1
0
 def __setstate__(self, state):
     # FIXME bug with sklearn-pandas 1.x that is fixed on 2.x (can
     # delete after upgrade)
     # horrible hack - DataFrameMapper does not call super.__setstate__
     # in 1.x, but we happen to know that its parent is BaseEstimator
     BaseEstimator.__setstate__(self, state)
     DataFrameMapper.__setstate__(self, state)
Пример #2
0
 def __setstate__(self, state):
     if get_library_path is None:
         raise ImportError("onnxruntime_extensions is not installed.")
     state['onnx_'] = load(BytesIO(state['onnx_']))
     BaseEstimator.__setstate__(self, state)
     so = SessionOptions()
     so.register_custom_ops_library(get_library_path())
     self.sess_ = InferenceSession(self.onnx_.SerializeToString(), so)
     return self
Пример #3
0
 def __setstate__(self, state):
     """
     :epkg:`pickle` does not support functions.
     This method restores the function created when
     the runtime is `'numpy'`.
     """
     BaseEstimator.__setstate__(self, state)
     if 'numpy_code_' in state:
         model_onnx = load(io.BytesIO(state['onnx_']))
         opsets = onnx_model_opsets(model_onnx)
         self.onnxrt_ = self._build_onnx_runtime_numpy_compile(opsets)
Пример #4
0
 def __setstate__(self, state):
     # FIXME see SubsetTransformer.__setstate__
     BaseEstimator.__setstate__(self, state)
     DataFrameMapper.__setstate__(self, state)