Open nikkisingh111333 opened 2 years ago
It looks to be caused by sklearn version mismatch. Could you check the sklearn version in these two different environments? Also, having the full traceback error message helps.
which version of sklearn is needed for flaml
ERROR:Exception in ASGI application
Traceback (most recent call last):
File "C:\Users\ACER\anaconda3\envs\pythonForAI\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 404, in run_asgi
result = await app( # type: ignore[func-returns-value]
File "C:\Users\ACER\anaconda3\envs\pythonForAI\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 78, in call
return await self.app(scope, receive, send)
File "C:\Users\ACER\AppData\Roaming\Python\Python39\site-packages\fastapi\applications.py", line 270, in call
await super().call(scope, receive, send)
File "C:\Users\ACER\AppData\Roaming\Python\Python39\site-packages\starlette\applications.py", line 124, in call
await self.middleware_stack(scope, receive, send)
File "C:\Users\ACER\AppData\Roaming\Python\Python39\site-packages\starlette\middleware\errors.py", line 184, in call
raise exc
File "C:\Users\ACER\AppData\Roaming\Python\Python39\site-packages\starlette\middleware\errors.py", line 162, in call
await self.app(scope, receive, _send)
File "C:\Users\ACER\AppData\Roaming\Python\Python39\site-packages\starlette\middleware\exceptions.py", line 75, in call
raise exc
File "C:\Users\ACER\AppData\Roaming\Python\Python39\site-packages\starlette\middleware\exceptions.py", line 64, in call
await self.app(scope, receive, sender)
File "C:\Users\ACER\AppData\Roaming\Python\Python39\site-packages\fastapi\middleware\asyncexitstack.py", line 21, in call
raise e
File "C:\Users\ACER\AppData\Roaming\Python\Python39\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in call
await self.app(scope, receive, send)
File "C:\Users\ACER\AppData\Roaming\Python\Python39\site-packages\starlette\routing.py", line 680, in call
await route.handle(scope, receive, send)
File "C:\Users\ACER\AppData\Roaming\Python\Python39\site-packages\starlette\routing.py", line 275, in handle
await self.app(scope, receive, send)
File "C:\Users\ACER\AppData\Roaming\Python\Python39\site-packages\starlette\routing.py", line 65, in app
response = await func(request)
File "C:\Users\ACER\AppData\Roaming\Python\Python39\site-packages\fastapi\routing.py", line 231, in app
raw_response = await run_endpoint_function(
File "C:\Users\ACER\AppData\Roaming\Python\Python39\site-packages\fastapi\routing.py", line 160, in run_endpoint_function
return await dependant.call(values)
File "H:\pythonForAI\FastAPIIntro.py", line 51, in predict
prediction=automl.predict(df.head(1))
File "C:\Users\ACER\anaconda3\envs\pythonForAI\lib\site-packages\flaml\automl.py", line 936, in predict
X = self._preprocess(X)
File "C:\Users\ACER\anaconda3\envs\pythonForAI\lib\site-packages\flaml\automl.py", line 1000, in _preprocess
X = self._transformer.transform(X)
File "C:\Users\ACER\anaconda3\envs\pythonForAI\lib\site-packages\flaml\data.py", line 479, in transform
X[num_columns] = self.transformer.transform(X_num)
File "C:\Users\ACER\anaconda3\envs\pythonForAI\lib\site-packages\sklearn\compose_column_transformer.py", line 763, in transform
Xs = self._fit_transform(
File "C:\Users\ACER\anaconda3\envs\pythonForAI\lib\site-packages\sklearn\compose_column_transformer.py", line 621, in _fit_transform
return Parallel(n_jobs=self.n_jobs)(
File "C:\Users\ACER\anaconda3\envs\pythonForAI\lib\site-packages\joblib\parallel.py", line 1085, in call
if self.dispatch_one_batch(iterator):
File "C:\Users\ACER\anaconda3\envs\pythonForAI\lib\site-packages\joblib\parallel.py", line 901, in dispatch_one_batch
self._dispatch(tasks)
File "C:\Users\ACER\anaconda3\envs\pythonForAI\lib\site-packages\joblib\parallel.py", line 819, in _dispatch
job = self._backend.apply_async(batch, callback=cb)
File "C:\Users\ACER\anaconda3\envs\pythonForAI\lib\site-packages\joblib_parallel_backends.py", line 208, in apply_async
result = ImmediateResult(func)
File "C:\Users\ACER\anaconda3\envs\pythonForAI\lib\site-packages\joblib_parallel_backends.py", line 597, in init
self.results = batch()
File "C:\Users\ACER\anaconda3\envs\pythonForAI\lib\site-packages\joblib\parallel.py", line 288, in call
return [func(*args, kwargs)
File "C:\Users\ACER\anaconda3\envs\pythonForAI\lib\site-packages\joblib\parallel.py", line 288, in
heres the full stacktrace
flaml requires scikit-learn>=0.24. But _fit_dtype
is not available before scikit-learn 1.1. I guess the automl object was created under scikit-learn 1.1 but then loaded with a lower version.
so suggest me a quick solution for his please.?
so suggest me a quick solution for his please.?
Use the same version of sklearn in your notebook which creates the automl object as the environment in which you load the automl object.
hi i m new into this FLAML. i m getting this error while predicting my banknote problem
while using colab i m not getting this error but on pycharm using fastapi i m getting this error
AttributeError: 'SimpleImputer' object has no attribute '_fit_dtype'
heres my code:
@app.post('/predict') async def predict(data:person): per=data.dict() df = pd.DataFrame([[per['variance'],per['skewness'],per['curtosis'],per['entropy']]],columns=['variance','skewness','curtosis','entropy']) print(df.head(1)) prediction=automl.predict(df.head(1)) print(prediction)
this is my data
variance skewness curtosis entropy 0 1.22 0.333 0.44 -3.22
what should i do?