# Buggy code
def fit(
    self,
    X,
    y,
    sample_weight=None,
    init_score=None,
    eval_set=None,
    eval_sample_weight=None,
    eval_init_score=None,
    **kwargs,
):
    params = self.get_params(True)
    model = train(
        params,
        self._wrap_train_tuple(X, y, sample_weight, init_score),
        eval_sets=self._wrap_eval_tuples(eval_set, eval_sample_weight, eval_init_score),
        model_type=LGBMModelType.REGRESSOR,
        **kwargs,
    )

    self.set_params(**model.get_params())
    self._copy_extra_params(model, self)
    return self


# Traceback (ValueError)
Traceback (most recent call last):
File "/home/admin/work/_public-mars-0.4.2.zip/mars/scheduler/graph.py", line 371, in _execute_graph
File "/home/admin/work/_public-mars-0.4.2.zip/mars/utils.py", line 343, in _wrapped
File "/home/admin/work/_public-mars-0.4.2.zip/mars/utils.py", line 483, in inner
File "/home/admin/work/_public-mars-0.4.2.zip/mars/scheduler/graph.py", line 603, in prepare_graph
File "/home/admin/work/_public-mars-0.4.2.zip/mars/utils.py", line 389, in _wrapped
File "/home/admin/work/_public-mars-0.4.2.zip/mars/utils.py", line 483, in inner
File "/home/admin/work/_public-mars-0.4.2.zip/mars/tiles.py", line 342, in build
File "/home/admin/work/_public-mars-0.4.2.zip/mars/utils.py", line 389, in _wrapped
File "/home/admin/work/_public-mars-0.4.2.zip/mars/utils.py", line 483, in inner
File "/home/admin/work/_public-mars-0.4.2.zip/mars/tiles.py", line 255, in build
File "/home/admin/work/_public-mars-0.4.2.zip/mars/tiles.py", line 294, in inner
File "/home/admin/work/_public-mars-0.4.2.zip/mars/tiles.py", line 235, in build
File "/home/admin/work/_public-mars-0.4.2.zip/mars/tiles.py", line 330, in _tile
File "/home/admin/work/_public-mars-0.4.2.zip/mars/tiles.py", line 195, in _tile
File "/home/admin/work/_public-mars-0.4.2.zip/mars/scheduler/graph.py", line 586, in on_tile
File "/home/admin/work/_public-mars-0.4.2.zip/mars/context.py", line 68, in h
File "/home/admin/work/_public-mars-0.4.2.zip/mars/utils.py", line 389, in _wrapped
File "/home/admin/work/_public-mars-0.4.2.zip/mars/tiles.py", line 115, in dispatch
File "/home/admin/work/_public-mars-0.4.2.zip/mars/learn/contrib/lightgbm/align.py", line 87, in tile
File "/home/admin/work/_public-mars-0.4.2.zip/mars/dataframe/base/rechunk.py", line 90, in rechunk
File "/home/admin/work/_public-mars-0.4.2.zip/mars/tensor/rechunk/core.py", line 38, in get_nsplits
File "/home/admin/work/_public-mars-0.4.2.zip/mars/tensor/utils.py", line 549, in decide_chunk_sizes
File "/home/admin/work/_public-mars-0.4.2.zip/mars/tensor/utils.py", line 67, in normalize_chunk_sizes
ValueError: chunks shape should be of the same length, got shape: nan, chunks: (nan,)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/admin/work/_public-mars-0.4.2.zip/mars/promise.py", line 100, in _wrapped
File "/home/admin/work/_public-mars-0.4.2.zip/mars/worker/calc.py", line 271, in <lambda>
File "/home/admin/work/_public-mars-0.4.2.zip/mars/worker/calc.py", line 244, in _start_calc
File "/home/admin/work/_public-mars-0.4.2.zip/mars/worker/calc.py", line 173, in _calc_results
File "src/gevent/event.py", line 383, in gevent._gevent_cevent.AsyncResult.result
File "src/gevent/event.py", line 305, in gevent._gevent_cevent.AsyncResult.get
File "src/gevent/event.py", line 335, in gevent._gevent_cevent.AsyncResult.get
File "src/gevent/event.py", line 323, in gevent._gevent_cevent.AsyncResult.get
File "src/gevent/event.py", line 303, in gevent._gevent_cevent.AsyncResult._raise_exception
File "/opt/conda/lib/python3.7/site-packages/gevent/_compat.py", line 65, in reraise
File "/opt/conda/lib/python3.7/site-packages/gevent/threadpool.py", line 142, in __run_task
File "mars/actors/pool/gevent_pool.pyx", line 127, in mars.actors.pool.gevent_pool.GeventThreadPool._wrap_watch.inner
result = fn(*args, **kwargs)
File "/home/admin/work/_public-mars-0.4.2.zip/mars/executor.py", line 690, in execute_graph
File "/home/admin/work/_public-mars-0.4.2.zip/mars/executor.py", line 571, in execute
File "/opt/conda/lib/python3.7/concurrent/futures/_base.py", line 435, in result
File "/opt/conda/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
File "/opt/conda/lib/python3.7/concurrent/futures/thread.py", line 57, in run
File "/home/admin/work/_public-mars-0.4.2.zip/mars/executor.py", line 443, in _execute_operand
File "/home/admin/work/_public-mars-0.4.2.zip/mars/executor.py", line 641, in handle
File "/home/admin/work/_public-pyodps-0.9.3.zip/odps/mars_extension/core.py", line 187, in wrapper
File "/home/admin/work/_public-mars-0.4.2.zip/mars/remote/core.py", line 200, in execute
File "E:/MyDocuments/PycharmProjects/borrowloan/temp_query/test_mars.py", line 31, in light_gbm
lg_reg = lgb.LGBMRegressor()
File "/home/admin/work/_public-mars-0.4.2.zip/mars/learn/contrib/lightgbm/regressor.py", line 28, in fit
File "/home/admin/work/_public-mars-0.4.2.zip/mars/learn/contrib/lightgbm/train.py", line 322, in train
File "/home/admin/work/_public-mars-0.4.2.zip/mars/core.py", line 651, in execute
File "/home/admin/work/_public-mars-0.4.2.zip/mars/core.py", line 370, in execute
File "/home/admin/work/_public-mars-0.4.2.zip/mars/session.py", line 428, in run
File "/home/admin/work/_public-mars-0.4.2.zip/mars/session.py", line 303, in run
mars.errors.ExecutionFailed: '\'\\\'\\\\\\\'"\\\\\\\\\\\\\\\'Graph execution failed.\\\\\\\\\\\\\\\'"\\\\\\\'\\\'\''

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "E:/MyDocuments/PycharmProjects/borrowloan/temp_query/test_mars.py", line 38, in <module>
odps.run_mars_job(light_gbm, args=(tb_name,), worker_num=2, worker_cpu=2, worker_mem=8, mars_image='extended',
File "F:\Anaconda3\lib\site-packages\odps\mars_extension\core.py", line 151, in run_mars_job
r.execute()
File "F:\Anaconda3\lib\site-packages\mars\core.py", line 370, in execute
session.run(self, **kw)
File "F:\Anaconda3\lib\site-packages\mars\session.py", line 428, in run
result = self._sess.run(*tileables, **kw)
File "F:\Anaconda3\lib\site-packages\mars\web\session.py", line 187, in run
if self._check_response_finished(graph_url, timeout_val):
File "F:\Anaconda3\lib\site-packages\mars\web\session.py", line 146, in _check_response_finished
raise ExecutionFailed('Graph execution failed.') from exc
mars.errors.ExecutionFailed: 'Graph execution failed.'

# Fixed code
def fit(
    self,
    X,
    y,
    sample_weight=None,
    init_score=None,
    eval_set=None,
    eval_sample_weight=None,
    eval_init_score=None,
    session=None,
    run_kwargs=None,
    **kwargs,
):
    check_consistent_length(X, y, session=session, run_kwargs=run_kwargs)
    params = self.get_params(True)
    model = train(
        params,
        self._wrap_train_tuple(X, y, sample_weight, init_score),
        eval_sets=self._wrap_eval_tuples(eval_set, eval_sample_weight, eval_init_score),
        model_type=LGBMModelType.REGRESSOR,
        session=session,
        run_kwargs=run_kwargs,
        **kwargs,
    )

    self.set_params(**model.get_params())
    self._copy_extra_params(model, self)
    return self