huggingface / autotrain-advanced

🤗 AutoTrain Advanced
https://huggingface.co/autotrain
Apache License 2.0
3.84k stars 471 forks source link

Tabular regression - AttributeError: 'NoneType' object has no attribute 'strip' #402

Closed sabatale closed 9 months ago

sabatale commented 9 months ago

We get the error AttributeError: 'NoneType' object has no attribute 'strip' no matter the input for Tabular regression.

Using the csv sample from the docs yields the same result:

id,category1,category2,feature1,target
1,A,X,0.3373961604172684,1
2,B,Z,0.6481718720511972,0
3,A,Y,0.36824153984054797,1
4,B,Z,0.9571551589530464,1
5,B,Z,0.14035078041264515,1
6,C,X,0.8700872583584364,1
7,A,Y,0.4736080452737105,0
8,C,Y,0.8009107519796442,1
9,A,Y,0.5204774795512048,0
10,A,Y,0.6788795301189603,0
> INFO    [{"seed":42,"categorical_columns":null,"numerical_columns":null,"num_trials":10,"time_limit":600,"categorical_imputer":null,"numerical_imputer":null,"numeric_scaler":null,"model_choice":"xgboost","param_choice":"manual","backend":"CPU (Free)"}]
INFO:     10.16.18.44:42349 - "POST /create_project HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/app/env/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 428, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "/app/env/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
    return await self.app(scope, receive, send)
  File "/app/env/lib/python3.10/site-packages/fastapi/applications.py", line 1106, in __call__
    await super().__call__(scope, receive, send)
  File "/app/env/lib/python3.10/site-packages/starlette/applications.py", line 122, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/app/env/lib/python3.10/site-packages/starlette/middleware/errors.py", line 184, in __call__
    raise exc
  File "/app/env/lib/python3.10/site-packages/starlette/middleware/errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "/app/env/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
    raise exc
  File "/app/env/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "/app/env/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 20, in __call__
    raise e
  File "/app/env/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 17, in __call__
    await self.app(scope, receive, send)
  File "/app/env/lib/python3.10/site-packages/starlette/routing.py", line 718, in __call__
    await route.handle(scope, receive, send)
  File "/app/env/lib/python3.10/site-packages/starlette/routing.py", line 276, in handle
    await self.app(scope, receive, send)
  File "/app/env/lib/python3.10/site-packages/starlette/routing.py", line 66, in app
    response = await func(request)
  File "/app/env/lib/python3.10/site-packages/fastapi/routing.py", line 274, in app
    raw_response = await run_endpoint_function(
  File "/app/env/lib/python3.10/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
    return await dependant.call(**values)
  File "/app/src/autotrain/app.py", line 435, in handle_form
    ids = project.create()
  File "/app/src/autotrain/project.py", line 198, in create
    return self.create_spaces()
  File "/app/src/autotrain/project.py", line 173, in create_spaces
    _params = self._munge_params_tabular(job_idx)
  File "/app/src/autotrain/project.py", line 143, in _munge_params_tabular
    if len(_params["categorical_imputer"].strip()) == 0 or _params["categorical_imputer"].lower() == "none":
AttributeError: 'NoneType' object has no attribute 'strip'
abhishekkrthakur commented 9 months ago

thanks. im taking a look!

mikeagz commented 9 months ago

Same issue on HF Space, but in Classfication tasks

abhishekkrthakur commented 9 months ago

fixed.

sabatale commented 9 months ago

@abhishekkrthakur A side question if you don't mind. Is it normal the model type is not recognized properly after being generated with Autotrain?

image

abhishekkrthakur commented 9 months ago

for tabular, it is an issue. will fix! creating a new issue

vish01 commented 5 months ago

I'm still getting this error when running locally. This is the command I'm using: autotrain llm --train --project-name llm-test --model abhishek/llama-2-7b-hf-small-shards --use-peft --trainer sft --data-path . --text-column text --block-size 16 --lr 2e-4 --quantization int4 --gradient-accumulation 4 --mixed-precision none