mars
mars copied to clipboard
[BUG] Ray executor run inv_mapper raises ValueError: assignment destination is read-only
Describe the bug A clear and concise description of what the bug is.
__________________________ test_label_encoder[int64] ___________________________
setup = <mars.deploy.oscar.session.SyncSession object at 0x337a3c7f0>
values = array([2, 1, 3, 1, 3]), classes = array([1, 2, 3])
unknown = array([4])
@pytest.mark.parametrize(
"values, classes, unknown",
[
(
np.array([2, 1, 3, 1, 3], dtype="int64"),
np.array([1, 2, 3], dtype="int64"),
np.array([4], dtype="int64"),
),
(
np.array(["b", "a", "c", "a", "c"], dtype=object),
np.array(["a", "b", "c"], dtype=object),
np.array(["d"], dtype=object),
),
(
np.array(["b", "a", "c", "a", "c"]),
np.array(["a", "b", "c"]),
np.array(["d"]),
),
],
ids=["int64", "object", "str"],
)
def test_label_encoder(setup, values, classes, unknown):
# Test LabelEncoder's transform, fit_transform and
# inverse_transform methods
values_t = mt.tensor(values)
le = LabelEncoder()
le.fit(values_t)
assert_array_equal(le.classes_.fetch(), classes)
assert_array_equal(le.transform(values_t).fetch(), [1, 0, 2, 0, 2])
assert_array_equal(le.inverse_transform(mt.tensor([1, 0, 2, 0, 2])).fetch(), values)
le = LabelEncoder()
> ret = le.fit_transform(values)
mars/learn/preprocessing/tests/test_label.py:300:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
mars/learn/preprocessing/_label.py:122: in fit_transform
self.classes_, y = execute_tileable(
mars/deploy/oscar/session.py:1888: in execute
return session.execute(
mars/deploy/oscar/session.py:1682: in execute
execution_info: ExecutionInfo = fut.result(
../../.pyenv/versions/3.8.13/lib/python3.8/concurrent/futures/_base.py:444: in result
return self.__get_result()
../../.pyenv/versions/3.8.13/lib/python3.8/concurrent/futures/_base.py:389: in __get_result
raise self._exception
mars/deploy/oscar/session.py:1868: in _execute
await execution_info
../../.pyenv/versions/3.8.13/lib/python3.8/asyncio/tasks.py:695: in _wrap_awaitable
return (yield from awaitable.__await__())
mars/deploy/oscar/session.py:105: in wait
return await self._aio_task
mars/deploy/oscar/session.py:953: in _run_in_background
raise task_result.error.with_traceback(task_result.traceback)
mars/services/task/supervisor/processor.py:372: in run
await self._process_stage_chunk_graph(*stage_args)
mars/services/task/supervisor/processor.py:250: in _process_stage_chunk_graph
chunk_to_result = await self._executor.execute_subtask_graph(
mars/services/task/execution/ray/executor.py:551: in execute_subtask_graph
meta_list = await asyncio.gather(*output_meta_object_refs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
awaitable = ObjectRef(b2d1bf24c5f98f84ffffffffffffffffffffffff0100000001000000)
@types.coroutine
def _wrap_awaitable(awaitable):
"""Helper for asyncio.ensure_future().
Wraps awaitable (an object with __await__) into a coroutine
that will later be wrapped in a Task by ensure_future().
"""
> return (yield from awaitable.__await__())
E ray.exceptions.RayTaskError(ValueError): ray::execute_subtask() (pid=97485, ip=127.0.0.1)
E File "/home/admin/mars/mars/services/task/execution/ray/executor.py", line 185, in execute_subtask
E execute(context, chunk.op)
E File "/home/admin/mars/mars/core/operand/core.py", line 491, in execute
E result = executor(results, op)
E File "/home/admin/mars/mars/core/custom_log.py", line 94, in wrap
E return func(cls, ctx, op)
E File "/home/admin/mars/mars/utils.py", line 1160, in wrapped
E return func(cls, ctx, op)
E File "/home/admin/mars/mars/tensor/base/map_chunk.py", line 170, in execute
E ctx[op.outputs[0].key] = op.func(in_data, *args, **kwargs)
E File "/home/admin/mars/mars/learn/utils/_encode.py", line 72, in inv_mapper
E c[c > idx] = idx
E ValueError: assignment destination is read-only
../../.pyenv/versions/3.8.13/lib/python3.8/asyncio/tasks.py:695: RayTaskError(ValueError)
To Reproduce To help us reproducing this bug, please provide information below:
- Your Python version
- The version of Mars you use
- Versions of crucial packages, such as numpy, scipy and pandas
- Full stack of the error.
- Minimized code to reproduce the error.
Expected behavior A clear and concise description of what you expected to happen.
Additional context Add any other context about the problem here.