Skip to content

Commit

Permalink
ENH: Speed up cli interaction (#2443)
Browse files Browse the repository at this point in the history
  • Loading branch information
frostyplanet authored Oct 17, 2024
1 parent 7d7d2b4 commit 7b1f0b4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
4 changes: 0 additions & 4 deletions xinference/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,9 @@
def _install():
from xoscar.backends.router import Router

from .model import _install as install_model

default_router = Router.get_instance_or_empty()
Router.set_instance(default_router)

install_model()


_install()
del _install
4 changes: 4 additions & 0 deletions xinference/deploy/supervisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@

logger = logging.getLogger(__name__)

from ..model import _install as install_model

install_model()


async def _start_supervisor(address: str, logging_conf: Optional[Dict] = None):
logging.config.dictConfig(logging_conf) # type: ignore
Expand Down
4 changes: 4 additions & 0 deletions xinference/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@ def _install():
image_install()
rerank_install()
video_install()


_install()
del _install
5 changes: 2 additions & 3 deletions xinference/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
# limitations under the License.


import torch


def cuda_count():
import torch

# even if install torch cpu, this interface would return 0.
return torch.cuda.device_count()

0 comments on commit 7b1f0b4

Please sign in to comment.