Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: ChatGLM Parameter Switch #260

Closed
Bojun-Feng opened this issue Jul 28, 2023 · 0 comments · Fixed by #262
Closed

BUG: ChatGLM Parameter Switch #260

Bojun-Feng opened this issue Jul 28, 2023 · 0 comments · Fixed by #262
Labels
bug Something isn't working
Milestone

Comments

@Bojun-Feng
Copy link
Contributor

Describe the bug

ChatGLM fails to start, seems like two parameters model_path and quantization were passed in reverse.

Additional context

Full IPython History
In [1]: from xinference.client import Client
   ...: 
   ...: client = Client("http://localhost:9997")
   ...: model_uid = client.launch_model(model_name="chatglm2")
   ...: model = client.get_model(model_uid)
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Cell In[1], line 4
      1 from xinference.client import Client
      3 client = Client("http://localhost:9997")
----> 4 model_uid = client.launch_model(model_name="chatglm2")
      5 model = client.get_model(model_uid)

File ~/Desktop/cs/inference/xinference/client.py:282, in Client.launch_model(self, model_name, model_size_in_billions, model_format, quantization, **kwargs)
    272 model_uid = self.gen_model_uid()
    274 coro = self._supervisor_ref.launch_builtin_model(
    275     model_uid=model_uid,
    276     model_name=model_name,
   (...)
    280     **kwargs,
    281 )
--> 282 self._isolation.call(coro)
    284 return model_uid

File ~/Desktop/cs/inference/xinference/isolation.py:44, in Isolation.call(self, coro)
     42 def call(self, coro: Coroutine) -> Any:
     43     fut = asyncio.run_coroutine_threadsafe(coro, self._loop)
---> 44     return fut.result()

File ~/anaconda3/lib/python3.11/concurrent/futures/_base.py:456, in Future.result(self, timeout)
    454     raise CancelledError()
    455 elif self._state == FINISHED:
--> 456     return self.__get_result()
    457 else:
    458     raise TimeoutError()

File ~/anaconda3/lib/python3.11/concurrent/futures/_base.py:401, in Future.__get_result(self)
    399 if self._exception:
    400     try:
--> 401         raise self._exception
    402     finally:
    403         # Break a reference cycle with the exception in self._exception
    404         self = None

File ~/anaconda3/lib/python3.11/site-packages/xoscar/backends/context.py:227, in IndigenActorContext.send(self, actor_ref, message, wait_response, profiling_context)
    225 if wait_response:
    226     result = await self._wait(future, actor_ref.address, send_message)  # type: ignore
--> 227     return self._process_result_message(result)
    228 else:
    229     return future

File ~/anaconda3/lib/python3.11/site-packages/xoscar/backends/context.py:102, in IndigenActorContext._process_result_message(message)
    100     return message.result
    101 else:
--> 102     raise message.as_instanceof_cause()

File ~/anaconda3/lib/python3.11/site-packages/xoscar/backends/pool.py:657, in send()
    655         raise ActorNotExist(f"Actor {actor_id} does not exist")
    656     coro = self._actors[actor_id].__on_receive__(message.content)
--> 657     result = await self._run_coro(message.message_id, coro)
    658     processor.result = ResultMessage(
    659         message.message_id,
    660         result,
    661         protocol=message.protocol,
    662         profiling_context=message.profiling_context,
    663     )
    664 return processor.result

File ~/anaconda3/lib/python3.11/site-packages/xoscar/backends/pool.py:368, in _run_coro()
    366 self._process_messages[message_id] = asyncio.tasks.current_task()
    367 try:
--> 368     return await coro
    369 finally:
    370     self._process_messages.pop(message_id, None)

File ~/anaconda3/lib/python3.11/site-packages/xoscar/api.py:306, in __on_receive__()
    297 async def __on_receive__(self, message: Tuple[Any]):
    298     """
    299     Handle message from other actors and dispatch them to user methods
    300 
   (...)
    304         Message shall be (method_name,) + args + (kwargs,)
    305     """
--> 306     return await super().__on_receive__(message)

File ~/anaconda3/lib/python3.11/site-packages/xoscar/core.pyx:527, in __on_receive__()
    525     debug_logger.exception('Got unhandled error when handling message %.500r '
    526                            'in actor %s at %s', message, self.uid, self.address)
--> 527 raise ex
    528 
    529 

File ~/anaconda3/lib/python3.11/site-packages/xoscar/core.pyx:519, in xoscar.core._BaseActor.__on_receive__()
    517         raise ValueError(f'call_method {call_method} not valid')
    518 
--> 519     return await self._handle_actor_result(result)
    520 except Exception as ex:
    521     if _log_unhandled_errors:

File ~/anaconda3/lib/python3.11/site-packages/xoscar/core.pyx:404, in _handle_actor_result()
    402 # asyncio.wait as it introduces much overhead
    403 if len(coros) == 1:
--> 404     task_result = await coros[0]
    405     if extract_tuple:
    406         result = task_result

File ~/anaconda3/lib/python3.11/site-packages/xoscar/core.pyx:447, in _run_actor_async_generator()
    445 res = None
    446 while True:
--> 447     async with self._lock:
    448         with debug_async_timeout('actor_lock_timeout',
    449                                  'async_generator %r hold lock timeout', gen):

File ~/anaconda3/lib/python3.11/site-packages/xoscar/core.pyx:448, in xoscar.core._BaseActor._run_actor_async_generator()
    446 while True:
    447     async with self._lock:
--> 448         with debug_async_timeout('actor_lock_timeout',
    449                                  'async_generator %r hold lock timeout', gen):
    450             if not is_exception:

File ~/anaconda3/lib/python3.11/site-packages/xoscar/core.pyx:453, in xoscar.core._BaseActor._run_actor_async_generator()
    451             res = await gen.asend(res)
    452         else:
--> 453             res = await gen.athrow(*res)
    454 try:
    455     if _log_cycle_send:

File ~/Desktop/cs/inference/xinference/core/service.py:119, in launch_builtin_model()
    116     raise ValueError(f"Model is already in the model list, uid: {model_uid}")
    118 worker_ref = await self._choose_worker()
--> 119 model_ref = yield worker_ref.launch_builtin_model(
    120     model_uid=model_uid,
    121     model_name=model_name,
    122     model_size_in_billions=model_size_in_billions,
    123     model_format=model_format,
    124     quantization=quantization,
    125     **kwargs,
    126 )
    127 # TODO: not protected.
    128 self._model_uid_to_worker[model_uid] = worker_ref

File ~/anaconda3/lib/python3.11/site-packages/xoscar/core.pyx:458, in xoscar.core._BaseActor._run_actor_async_generator()
    456         message_trace = pop_message_trace()
    457 
--> 458     res = await self._handle_actor_result(res)
    459     is_exception = False
    460 except:

File ~/anaconda3/lib/python3.11/site-packages/xoscar/core.pyx:378, in _handle_actor_result()
    376 
    377         if inspect.isawaitable(result):
--> 378             result = await result
    379         elif is_async_generator(result):
    380             result = (result,)

File ~/anaconda3/lib/python3.11/site-packages/xoscar/core.pyx:266, in __pyx_actor_method_wrapper()
    264 
    265 async def __pyx_actor_method_wrapper(method, result_handler, lock, args, kwargs):
--> 266     async with lock:
    267         result = method(*args, **kwargs)
    268         if asyncio.iscoroutine(result):

File ~/anaconda3/lib/python3.11/site-packages/xoscar/core.pyx:269, in xoscar.core.__pyx_actor_method_wrapper()
    267     result = method(*args, **kwargs)
    268     if asyncio.iscoroutine(result):
--> 269         result = await result
    270 return await result_handler(result)
    271 

File ~/Desktop/cs/inference/xinference/core/service.py:44, in wrapped()
     42 logger.debug(f"Enter {func.__name__}, args: {args}, kwargs: {kwargs}")
     43 start = time.time()
---> 44 ret = await func(*args, **kwargs)
     45 logger.debug(
     46     f"Leave {func.__name__}, elapsed time: {int(time.time() - start)} ms"
     47 )
     48 return ret

File ~/Desktop/cs/inference/xinference/core/service.py:324, in launch_builtin_model()
    320 subpool_address = self._choose_subpool()
    321 model_ref = await xo.create_actor(
    322     ModelActor, address=subpool_address, uid=model_uid, model=model
    323 )
--> 324 await model_ref.load()
    325 self._model_uid_to_model[model_uid] = model_ref
    326 self._model_uid_to_model_spec[model_uid] = (llm_family, llm_spec, quantization)

File ~/anaconda3/lib/python3.11/site-packages/xoscar/backends/context.py:227, in send()
    225 if wait_response:
    226     result = await self._wait(future, actor_ref.address, send_message)  # type: ignore
--> 227     return self._process_result_message(result)
    228 else:
    229     return future

File ~/anaconda3/lib/python3.11/site-packages/xoscar/backends/context.py:102, in _process_result_message()
    100     return message.result
    101 else:
--> 102     raise message.as_instanceof_cause()

File ~/anaconda3/lib/python3.11/site-packages/xoscar/backends/pool.py:657, in send()
    655         raise ActorNotExist(f"Actor {actor_id} does not exist")
    656     coro = self._actors[actor_id].__on_receive__(message.content)
--> 657     result = await self._run_coro(message.message_id, coro)
    658     processor.result = ResultMessage(
    659         message.message_id,
    660         result,
    661         protocol=message.protocol,
    662         profiling_context=message.profiling_context,
    663     )
    664 return processor.result

File ~/anaconda3/lib/python3.11/site-packages/xoscar/backends/pool.py:368, in _run_coro()
    366 self._process_messages[message_id] = asyncio.tasks.current_task()
    367 try:
--> 368     return await coro
    369 finally:
    370     self._process_messages.pop(message_id, None)

File ~/anaconda3/lib/python3.11/site-packages/xoscar/api.py:306, in __on_receive__()
    297 async def __on_receive__(self, message: Tuple[Any]):
    298     """
    299     Handle message from other actors and dispatch them to user methods
    300 
   (...)
    304         Message shall be (method_name,) + args + (kwargs,)
    305     """
--> 306     return await super().__on_receive__(message)

File ~/anaconda3/lib/python3.11/site-packages/xoscar/core.pyx:527, in __on_receive__()
    525     debug_logger.exception('Got unhandled error when handling message %.500r '
    526                            'in actor %s at %s', message, self.uid, self.address)
--> 527 raise ex
    528 
    529 

File ~/anaconda3/lib/python3.11/site-packages/xoscar/core.pyx:497, in xoscar.core._BaseActor.__on_receive__()
    495 if call_method == CALL_METHOD_DEFAULT:
    496     func = getattr(self, method)
--> 497     async with self._lock:
    498         with debug_async_timeout('actor_lock_timeout',
    499                                  "Method %s of actor %s hold lock timeout.",

File ~/anaconda3/lib/python3.11/site-packages/xoscar/core.pyx:498, in xoscar.core._BaseActor.__on_receive__()
    496 func = getattr(self, method)
    497 async with self._lock:
--> 498     with debug_async_timeout('actor_lock_timeout',
    499                              "Method %s of actor %s hold lock timeout.",
    500                              method, self.uid):

File ~/anaconda3/lib/python3.11/site-packages/xoscar/core.pyx:501, in xoscar.core._BaseActor.__on_receive__()
    499                      "Method %s of actor %s hold lock timeout.",
    500                      method, self.uid):
--> 501 result = func(*args, **kwargs)
    502 if asyncio.iscoroutine(result):
    503     result = await result

File ~/Desktop/cs/inference/xinference/core/model.py:86, in load()
     85 def load(self):
---> 86     self._model.load()

File ~/Desktop/cs/inference/xinference/model/llm/ggml/chatglm.py:84, in load()
     74     installation_guide = [
     75         "Please make sure 'chatglm_cpp' is installed. ",
     76         "You can install it by running the following command in the terminal:\n",
   (...)
     79         "https://github.com/li-plus/chatglm.cpp",
     80     ]
     82     raise ImportError(f"{error_message}\n\n{''.join(installation_guide)}")
---> 84 self._llm = chatglm_cpp.Pipeline(Path(self.model_path))

File ~/anaconda3/lib/python3.11/site-packages/chatglm_cpp/__init__.py:13, in __init__()
     11 def __init__(self, model_path: os.PathLike) -> None:
     12     model_path = Path(model_path)
---> 13     super().__init__(str(model_path))

RuntimeError: [address=localhost:62884, pid=51919] /Users/fengbojun/Desktop/cs/chatglm.cpp/chatglm.cpp:250 check failed (fd > 0) cannot open file q4_0: No such file or directory

@XprobeBot XprobeBot added the bug Something isn't working label Jul 28, 2023
@XprobeBot XprobeBot added this to the v0.1.0 milestone Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants