Skip to content

Commit

Permalink
ci: auto fixes from pre-commit.ci
Browse files Browse the repository at this point in the history
For more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Aug 19, 2024
1 parent 436a3f9 commit 184726f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 21 deletions.
6 changes: 2 additions & 4 deletions src/openllm/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@
import questionary
import typer

from openllm.accelerator_spec import (DeploymentTarget, can_run,
get_local_machine_spec)
from openllm.accelerator_spec import DeploymentTarget, can_run, get_local_machine_spec
from openllm.analytic import DO_NOT_TRACK, OpenLLMTyper
from openllm.clean import app as clean_app
from openllm.cloud import deploy as cloud_deploy
from openllm.cloud import ensure_cloud_context, get_cloud_machine_spec
from openllm.common import (CHECKED, INTERACTIVE, VERBOSE_LEVEL, BentoInfo,
output)
from openllm.common import CHECKED, INTERACTIVE, VERBOSE_LEVEL, BentoInfo, output
from openllm.local import run as local_run
from openllm.local import serve as local_serve
from openllm.model import app as model_app
Expand Down
3 changes: 1 addition & 2 deletions src/openllm/clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
import questionary

from openllm.analytic import OpenLLMTyper
from openllm.common import (CONFIG_FILE, REPO_DIR, VENV_DIR, VERBOSE_LEVEL,
output)
from openllm.common import CONFIG_FILE, REPO_DIR, VENV_DIR, VERBOSE_LEVEL, output

app = OpenLLMTyper(help='clean up and release disk space used by OpenLLM')

Expand Down
3 changes: 1 addition & 2 deletions src/openllm/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@

from openllm.accelerator_spec import ACCELERATOR_SPECS
from openllm.analytic import OpenLLMTyper
from openllm.common import (INTERACTIVE, BentoInfo, DeploymentTarget, output,
run_command)
from openllm.common import INTERACTIVE, BentoInfo, DeploymentTarget, output, run_command

app = OpenLLMTyper()

Expand Down
22 changes: 9 additions & 13 deletions src/openllm/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,7 @@ def is_seen(value):
output(table)


def ensure_bento(
model: str,
target: Optional[DeploymentTarget] = None,
repo_name: Optional[str] = None,
) -> BentoInfo:
def ensure_bento(model: str, target: Optional[DeploymentTarget] = None, repo_name: Optional[str] = None) -> BentoInfo:
bentos = list_bento(model, repo_name=repo_name)
if len(bentos) == 0:
output(f'No model found for {model}', style='red')
Expand All @@ -67,9 +63,11 @@ def ensure_bento(
if len(bentos) == 1:
output(f'Found model {bentos[0]}', style='green')
if target is not None and can_run(bentos[0], target) <= 0:
output(f'The machine({target.name}) with {target.accelerators_repr} does not appear to have sufficient '
f'resources to run model {bentos[0]}\n',
style='yellow')
output(
f'The machine({target.name}) with {target.accelerators_repr} does not appear to have sufficient '
f'resources to run model {bentos[0]}\n',
style='yellow',
)
return bentos[0]

# multiple models, pick one according to target
Expand All @@ -90,14 +88,12 @@ def _extract_first_number(s: str):


def list_bento(
tag: typing.Optional[str] = None,
repo_name: typing.Optional[str] = None,
include_alias: bool = False,
tag: typing.Optional[str] = None, repo_name: typing.Optional[str] = None, include_alias: bool = False
) -> typing.List[BentoInfo]:
ensure_repo_updated()

if repo_name is None and tag and "/" in tag:
repo_name, tag = tag.split("/", 1)
if repo_name is None and tag and '/' in tag:
repo_name, tag = tag.split('/', 1)

if repo_name is not None:
config = load_config()
Expand Down

0 comments on commit 184726f

Please sign in to comment.