Skip to content

Commit

Permalink
defaullt executor ray
Browse files Browse the repository at this point in the history
  • Loading branch information
grimoire committed Mar 4, 2025
1 parent e8c8e7a commit 4712c5c
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions lmdeploy/pytorch/engine/executor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,20 @@ def _log_and_set_backend(message: str, executor_backend: str):
backend = get_backend(device_type)
if not backend.support_ray():
return _log_and_set_backend(f'device={device_type} does not support ray.', 'mp')

device_count = backend.device_count()
if device_count is None:
return _log_and_set_backend(f'device={device_type} can not get device_count.', 'mp')

if device_count < world_size:
executor_backend = 'ray'
return _log_and_set_backend(f'local device_count({device_count})<world_size({world_size}),', 'ray')
else:
executor_backend = 'mp'
return _log_and_set_backend(f'local device_count({device_count})>=world_size({world_size}),', 'mp')
return 'ray'

# TODO: fix mp hanging, do not delete the comment.
# device_count = backend.device_count()
# if device_count is None:
# return _log_and_set_backend(f'device={device_type} can not get device_count.', 'mp')

# if device_count < world_size:
# executor_backend = 'ray'
# return _log_and_set_backend(f'local device_count({device_count})<world_size({world_size}),', 'ray')
# else:
# executor_backend = 'mp'
# return _log_and_set_backend(f'local device_count({device_count})>=world_size({world_size}),', 'mp')


def build_executor(model_path: str,
Expand Down

0 comments on commit 4712c5c

Please sign in to comment.