lmdeploy icon indicating copy to clipboard operation
lmdeploy copied to clipboard

[Bug] glm-4v-9b多卡报错

Open Sunxiaohu0406 opened this issue 2 years ago • 2 comments

Checklist

  • [ ] 1. I have searched related issues but cannot get the expected help.
  • [ ] 2. The bug has not been fixed in the latest version.
  • [ ] 3. Please note that if the bug-related issue you submitted lacks corresponding environment info and a minimal reproducible demo, it will be challenging for us to reproduce and resolve the issue, reducing the likelihood of receiving feedback.

Describe the bug

/usr/local/python3.10.5/lib/python3.10/site-packages/torch_npu/utils/storage.py:38: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage() if self.device.type != 'cpu': ('Warning: torch.save with "_use_new_zipfile_serialization = False" is not recommended for npu tensor, which may bring unexpected errors and hopefully set "_use_new_zipfile_serialization = True"', 'if it is necessary to use this, please convert the npu tensor to cpu tensor for saving') [rank1]:[E compiler_depend.ts:270] call aclnnMatmulAllReduce failed, detail:EZ9999: Inner Error! EZ9999: [PID: 6140] 2024-12-04-15:32:53.009.508 Op MatmulAllReduce has 1 uncontiguous input, but set 0 auto conversion, may not set auto contiguous in op proto. TraceBack (most recent call last): Check NnopbaseExecutorUpdateAddr(executor, workspace, workspaceLen) failed Check NnopbaseRunWithWorkspace(executor, stream, workspace, workspaceSize) failed MatmulAllReduce, This is an error in launch aicore

[ERROR] 2024-12-04-15:32:53 (PID:6140, Device:1, RankID:-1) ERR01005 OPS internal error Exception raised from operator() at build/CMakeFiles/torch_npu.dir/compiler_depend.ts:134 (most recent call first): frame #0: c10::Error::Error(c10::SourceLocation, std::string) + 0x68 (0xffffa04e9ee8 in /usr/local/python3.10.5/lib/python3.10/site-packages/torch/lib/libc10.so) frame #1: c10::detail::torchCheckFail(char const*, char const*, unsigned int, std::string const&) + 0x6c (0xffffa0496d10 in /usr/local/python3.10.5/lib/python3.10/site-packages/torch/lib/libc10.so) frame #2: + 0xb149d0 (0xfffe942789d0 in /usr/local/python3.10.5/lib/python3.10/site-packages/torch_npu/lib/libtorch_npu.so) frame #3: + 0xe9bc30 (0xfffe945ffc30 in /usr/local/python3.10.5/lib/python3.10/site-packages/torch_npu/lib/libtorch_npu.so) frame #4: + 0x6198d4 (0xfffe93d7d8d4 in /usr/local/python3.10.5/lib/python3.10/site-packages/torch_npu/lib/libtorch_npu.so) frame #5: + 0x619d88 (0xfffe93d7dd88 in /usr/local/python3.10.5/lib/python3.10/site-packages/torch_npu/lib/libtorch_npu.so) frame #6: + 0x617360 (0xfffe93d7b360 in /usr/local/python3.10.5/lib/python3.10/site-packages/torch_npu/lib/libtorch_npu.so) frame #7: + 0xb967c (0xffffa052067c in /usr/local/python3.10.5/lib/python3.10/site-packages/torch/lib/libc10.so) frame #8: + 0x7624 (0xffffaa58a624 in /lib/aarch64-linux-gnu/libpthread.so.0) frame #9: + 0xd162c (0xffffaa69962c in /lib/aarch64-linux-gnu/libc.so.6)

[rank0]:[E compiler_depend.ts:270] call aclnnMatmulAllReduce failed, detail:EZ9999: Inner Error! EZ9999: [PID: 5766] 2024-12-04-15:32:53.010.561 Op MatmulAllReduce has 1 uncontiguous input, but set 0 auto conversion, may not set auto contiguous in op proto. TraceBack (most recent call last): Check NnopbaseExecutorUpdateAddr(executor, workspace, workspaceLen) failed Check NnopbaseRunWithWorkspace(executor, stream, workspace, workspaceSize) failed MatmulAllReduce, This is an error in launch aicore

[ERROR] 2024-12-04-15:32:53 (PID:5766, Device:0, RankID:-1) ERR01005 OPS internal error Exception raised from operator() at build/CMakeFiles/torch_npu.dir/compiler_depend.ts:134 (most recent call first): frame #0: c10::Error::Error(c10::SourceLocation, std::string) + 0x68 (0xffff9a3cbee8 in /usr/local/python3.10.5/lib/python3.10/site-packages/torch/lib/libc10.so) frame #1: c10::detail::torchCheckFail(char const*, char const*, unsigned int, std::string const&) + 0x6c (0xffff9a378d10 in /usr/local/python3.10.5/lib/python3.10/site-packages/torch/lib/libc10.so) frame #2: + 0xb149d0 (0xfffdf18119d0 in /usr/local/python3.10.5/lib/python3.10/site-packages/torch_npu/lib/libtorch_npu.so) frame #3: + 0xe9bc30 (0xfffdf1b98c30 in /usr/local/python3.10.5/lib/python3.10/site-packages/torch_npu/lib/libtorch_npu.so) frame #4: + 0x6198d4 (0xfffdf13168d4 in /usr/local/python3.10.5/lib/python3.10/site-packages/torch_npu/lib/libtorch_npu.so) frame #5: + 0x619d88 (0xfffdf1316d88 in /usr/local/python3.10.5/lib/python3.10/site-packages/torch_npu/lib/libtorch_npu.so) frame #6: + 0x617360 (0xfffdf1314360 in /usr/local/python3.10.5/lib/python3.10/site-packages/torch_npu/lib/libtorch_npu.so) frame #7: + 0xb967c (0xffff9a40267c in /usr/local/python3.10.5/lib/python3.10/site-packages/torch/lib/libc10.so) frame #8: + 0x7624 (0xffffa5966624 in /lib/aarch64-linux-gnu/libpthread.so.0) frame #9: + 0xd162c (0xffffa5a7562c in /lib/aarch64-linux-gnu/libc.so.6)

2024-12-04 15:32:53,016 - lmdeploy - ERROR - request.py:21 - Engine loop failed with error: The Inner error is reported as above. The process exits for this inner error, and the current working operator name is aclnnMatmulAllReduce. Since the operator is called asynchronously, the stacktrace may be inaccurate. If you want to get the accurate stacktrace, pleace set the environment variable ASCEND_LAUNCH_BLOCKING=1. [ERROR] 2024-12-04-15:32:53 (PID:5766, Device:0, RankID:-1) ERR00100 PTA call acl api failed Traceback (most recent call last): File "/opt/lmdeploy/lmdeploy/pytorch/engine/request.py", line 17, in _raise_exception_on_finish task.result() File "/opt/lmdeploy/lmdeploy/pytorch/engine/engine.py", line 963, in async_loop await self._async_loop() File "/opt/lmdeploy/lmdeploy/pytorch/engine/engine.py", line 957, in _async_loop await __step() File "/opt/lmdeploy/lmdeploy/pytorch/engine/engine.py", line 945, in __step raise e File "/opt/lmdeploy/lmdeploy/pytorch/engine/engine.py", line 939, in __step raise out File "/opt/lmdeploy/lmdeploy/pytorch/engine/engine.py", line 873, in _async_loop_background await self._async_step_background( File "/opt/lmdeploy/lmdeploy/pytorch/engine/engine.py", line 755, in _async_step_background output = await self._async_model_forward( File "/opt/lmdeploy/lmdeploy/utils.py", line 241, in __tmp return (await func(*args, **kwargs)) File "/opt/lmdeploy/lmdeploy/pytorch/engine/engine.py", line 646, in _async_model_forward ret = await __forward(inputs) File "/opt/lmdeploy/lmdeploy/pytorch/engine/engine.py", line 624, in __forward return await self.model_agent.async_forward( File "/opt/lmdeploy/lmdeploy/pytorch/engine/model_agent.py", line 745, in async_forward await asyncio.get_event_loop().run_in_executor(None, File "/usr/local/python3.10.5/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/usr/local/python3.10.5/lib/python3.10/site-packages/torch_npu/npu/streams.py", line 84, in synchronize super(Stream, self).synchronize() RuntimeError: The Inner error is reported as above. The process exits for this inner error, and the current working operator name is aclnnMatmulAllReduce. Since the operator is called asynchronously, the stacktrace may be inaccurate. If you want to get the accurate stacktrace, pleace set the environment variable ASCEND_LAUNCH_BLOCKING=1. [ERROR] 2024-12-04-15:32:53 (PID:5766, Device:0, RankID:-1) ERR00100 PTA call acl api failed ERROR: Exception in ASGI application Traceback (most recent call last): File "/usr/local/python3.10.5/lib/python3.10/asyncio/queues.py", line 159, in get await getter asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/python3.10.5/lib/python3.10/asyncio/tasks.py", line 456, in wait_for return fut.result() asyncio.exceptions.CancelledError

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

Traceback (most recent call last): File "/opt/lmdeploy/lmdeploy/pytorch/engine/request.py", line 171, in __no_threadsafe_get return await asyncio.wait_for(self.resp_que.get(), timeout) File "/usr/local/python3.10.5/lib/python3.10/asyncio/tasks.py", line 458, in wait_for raise exceptions.TimeoutError() from exc asyncio.exceptions.TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/python3.10.5/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 403, in run_asgi result = await app( # type: ignore[func-returns-value] File "/usr/local/python3.10.5/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in call return await self.app(scope, receive, send) File "/usr/local/python3.10.5/lib/python3.10/site-packages/fastapi/applications.py", line 1054, in call await super().call(scope, receive, send) File "/usr/local/python3.10.5/lib/python3.10/site-packages/starlette/applications.py", line 113, in call await self.middleware_stack(scope, receive, send) File "/usr/local/python3.10.5/lib/python3.10/site-packages/starlette/middleware/errors.py", line 165, in call await self.app(scope, receive, _send) File "/usr/local/python3.10.5/lib/python3.10/site-packages/starlette/middleware/cors.py", line 85, in call await self.app(scope, receive, send) File "/usr/local/python3.10.5/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 62, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "/usr/local/python3.10.5/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "/usr/local/python3.10.5/lib/python3.10/site-packages/starlette/routing.py", line 715, in call await self.middleware_stack(scope, receive, send) File "/usr/local/python3.10.5/lib/python3.10/site-packages/starlette/routing.py", line 735, in app await route.handle(scope, receive, send) File "/usr/local/python3.10.5/lib/python3.10/site-packages/starlette/routing.py", line 288, in handle await self.app(scope, receive, send) File "/usr/local/python3.10.5/lib/python3.10/site-packages/starlette/routing.py", line 76, in app await wrap_app_handling_exceptions(app, request)(scope, receive, send) File "/usr/local/python3.10.5/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "/usr/local/python3.10.5/lib/python3.10/site-packages/starlette/routing.py", line 73, in app response = await f(request) File "/usr/local/python3.10.5/lib/python3.10/site-packages/fastapi/routing.py", line 301, in app raw_response = await run_endpoint_function( File "/usr/local/python3.10.5/lib/python3.10/site-packages/fastapi/routing.py", line 212, in run_endpoint_function return await dependant.call(**values) File "/opt/lmdeploy/lmdeploy/serve/openai/api_server.py", line 483, in chat_completions_v1 async for res in result_generator: File "/opt/lmdeploy/lmdeploy/serve/async_engine.py", line 576, in generate async for outputs in generator.async_stream_infer( File "/opt/lmdeploy/lmdeploy/pytorch/engine/engine_instance.py", line 178, in async_stream_infer resp = await self.req_sender.async_recv(req_id) File "/opt/lmdeploy/lmdeploy/pytorch/engine/request.py", line 312, in async_recv resp: Response = await self._async_resp_get() File "/opt/lmdeploy/lmdeploy/pytorch/engine/request.py", line 187, in _async_resp_get return await __no_threadsafe_get() File "/opt/lmdeploy/lmdeploy/pytorch/engine/request.py", line 175, in __no_threadsafe_get exit(1) File "/usr/local/python3.10.5/lib/python3.10/_sitebuiltins.py", line 26, in call raise SystemExit(code) SystemExit: 1 INFO: 10.161.63.218:40742 - "POST /v1/chat/completions HTTP/1.1" 500 Internal Server Error

Reproduction

lmdeploy serve api_server
--eager-mode /home/nfs/appnfs/xxx/pre_models/ZhipuAI/glm-4v-9b
--backend pytorch
--model-name glm-4v-9b
--device ascend
--tp 2
--server-name 0.0.0.0
--server-port 50055

Environment

[W compiler_depend.ts:615] Warning: expandable_segments currently defaults to false. You can enable this feature by `export PYTORCH_NPU_ALLOC_CONF = expandable_segments:True`. (function operator())
sys.platform: linux
Python: 3.10.5 (main, Sep 24 2024, 03:43:49) [GCC 9.4.0]
CUDA available: False
MUSA available: False
numpy_random_seed: 2147483648
GCC: gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
PyTorch: 2.3.1
PyTorch compiling details: PyTorch built with:
  - GCC 10.2
  - C++ Version: 201703
  - Intel(R) MKL-DNN v3.3.6 (Git Hash 86e6af5974177e513fd3fee58425e1063e7f1361)
  - OpenMP 201511 (a.k.a. OpenMP 4.5)
  - LAPACK is enabled (usually provided by MKL)
  - NNPACK is enabled
  - CPU capability usage: NO AVX
  - Build settings: BLAS_INFO=open, BUILD_TYPE=Release, CXX_COMPILER=/opt/rh/devtoolset-10/root/usr/bin/c++, CXX_FLAGS= -D_GLIBCXX_USE_CXX11_ABI=0 -fabi-version=11 -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOCUPTI -DLIBKINETO_NOROCTRACER -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -O2 -fPIC -Wall -Wextra -Werror=return-type -Werror=non-virtual-dtor -Werror=bool-operation -Wnarrowing -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-function -Wno-unused-result -Wno-strict-overflow -Wno-strict-aliasing -Wno-stringop-overflow -Wsuggest-override -Wno-psabi -Wno-error=pedantic -Wno-error=old-style-cast -Wno-missing-braces -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, LAPACK_INFO=open, TORCH_VERSION=2.3.1, USE_CUDA=OFF, USE_CUDNN=OFF, USE_CUSPARSELT=OFF, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_GLOO=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=OFF, USE_NNPACK=ON, USE_OPENMP=ON, USE_ROCM=OFF, USE_ROCM_KERNEL_ASSERT=OFF, 

TorchVision: 0.18.1
LMDeploy: 0.6.3+
transformers: 4.46.3
gradio: Not Found
fastapi: 0.115.5
pydantic: 2.10.0
triton: Not Found

Error traceback

No response

Sunxiaohu0406 avatar Dec 04 '24 07:12 Sunxiaohu0406

I fixed this error in PR https://github.com/DeepLink-org/dlinfer/pull/121, we will merge this PR later. If you are in a hurry, you can try this PR.

yao-fengchen avatar Dec 06 '24 10:12 yao-fengchen

我在 PR DeepLink-org/dlinfer#121中修复了这个错误,我们稍后会合并这个 PR。如果你很着急,可以试试这个 PR。

感谢🙏,已解决。

Sunxiaohu0406 avatar Dec 09 '24 01:12 Sunxiaohu0406