move core -> distribution

This commit is contained in:
Ashwin Bharambe 2024-09-17 11:29:07 -07:00
parent bbf0b59ae4
commit 17172a8bf9
46 changed files with 70 additions and 57 deletions

View file

@ -92,7 +92,7 @@ def _hf_download(
from huggingface_hub import snapshot_download
from huggingface_hub.utils import GatedRepoError, RepositoryNotFoundError
from llama_stack.common.model_utils import model_local_dir
from llama_stack.distribution.utils.model_utils import model_local_dir
repo_id = model.huggingface_repo
if repo_id is None:
@ -126,7 +126,7 @@ def _hf_download(
def _meta_download(model: "Model", meta_url: str):
from llama_models.sku_list import llama_meta_net_info
from llama_stack.common.model_utils import model_local_dir
from llama_stack.distribution.utils.model_utils import model_local_dir
output_dir = Path(model_local_dir(model.descriptor()))
os.makedirs(output_dir, exist_ok=True)
@ -188,7 +188,7 @@ class Manifest(BaseModel):
def _download_from_manifest(manifest_file: str):
from llama_stack.common.model_utils import model_local_dir
from llama_stack.distribution.utils.model_utils import model_local_dir
with open(manifest_file, "r") as f:
d = json.load(f)

View file

@ -13,7 +13,7 @@ from termcolor import colored
from llama_stack.cli.subcommand import Subcommand
from llama_stack.cli.table import print_table
from llama_stack.common.serialize import EnumEncoder
from llama_stack.distribution.utils.serialize import EnumEncoder
class ModelDescribe(Subcommand):

View file

@ -7,7 +7,7 @@
import argparse
from llama_stack.cli.subcommand import Subcommand
from llama_stack.core.datatypes import * # noqa: F403
from llama_stack.distribution.datatypes import * # noqa: F403
from pathlib import Path
import yaml
@ -44,9 +44,9 @@ class StackBuild(Subcommand):
import json
import os
from llama_stack.common.config_dirs import DISTRIBS_BASE_DIR
from llama_stack.common.serialize import EnumEncoder
from llama_stack.core.package import ApiInput, build_image, ImageType
from llama_stack.distribution.utils.config_dirs import DISTRIBS_BASE_DIR
from llama_stack.distribution.utils.serialize import EnumEncoder
from llama_stack.distribution.build import ApiInput, build_image, ImageType
from termcolor import cprint
# save build.yaml spec for building same distribution again
@ -74,8 +74,8 @@ class StackBuild(Subcommand):
)
def _run_stack_build_command(self, args: argparse.Namespace) -> None:
from llama_stack.common.prompt_for_config import prompt_for_config
from llama_stack.core.dynamic import instantiate_class_type
from llama_stack.distribution.utils.prompt_for_config import prompt_for_config
from llama_stack.distribution.utils.dynamic import instantiate_class_type
if not args.config:
self.parser.error(

View file

@ -14,10 +14,10 @@ import yaml
from termcolor import cprint
from llama_stack.cli.subcommand import Subcommand
from llama_stack.common.config_dirs import BUILDS_BASE_DIR
from llama_stack.distribution.utils.config_dirs import BUILDS_BASE_DIR
from llama_stack.common.exec import run_with_pty
from llama_stack.core.datatypes import * # noqa: F403
from llama_stack.distribution.utils.exec import run_with_pty
from llama_stack.distribution.datatypes import * # noqa: F403
import os
@ -49,7 +49,7 @@ class StackConfigure(Subcommand):
)
def _run_stack_configure_cmd(self, args: argparse.Namespace) -> None:
from llama_stack.core.package import ImageType
from llama_stack.distribution.build import ImageType
docker_image = None
build_config_file = Path(args.config)
@ -66,7 +66,7 @@ class StackConfigure(Subcommand):
os.makedirs(builds_dir, exist_ok=True)
script = pkg_resources.resource_filename(
"llama_stack", "core/configure_container.sh"
"llama_stack", "distribution/configure_container.sh"
)
script_args = [script, docker_image, str(builds_dir)]
@ -95,8 +95,8 @@ class StackConfigure(Subcommand):
build_config: BuildConfig,
output_dir: Optional[str] = None,
):
from llama_stack.common.serialize import EnumEncoder
from llama_stack.core.configure import configure_api_providers
from llama_stack.distribution.configure import configure_api_providers
from llama_stack.distribution.utils.serialize import EnumEncoder
builds_dir = BUILDS_BASE_DIR / build_config.image_type
if output_dir:

View file

@ -26,7 +26,7 @@ class StackListApis(Subcommand):
def _run_apis_list_cmd(self, args: argparse.Namespace) -> None:
from llama_stack.cli.table import print_table
from llama_stack.core.distribution import stack_apis
from llama_stack.distribution.distribution import stack_apis
# eventually, this should query a registry at llama.meta.com/llamastack/distributions
headers = [

View file

@ -22,7 +22,7 @@ class StackListProviders(Subcommand):
self.parser.set_defaults(func=self._run_providers_list_cmd)
def _add_arguments(self):
from llama_stack.core.distribution import stack_apis
from llama_stack.distribution.distribution import stack_apis
api_values = [a.value for a in stack_apis()]
self.parser.add_argument(
@ -34,7 +34,7 @@ class StackListProviders(Subcommand):
def _run_providers_list_cmd(self, args: argparse.Namespace) -> None:
from llama_stack.cli.table import print_table
from llama_stack.core.distribution import Api, api_providers
from llama_stack.distribution.distribution import Api, api_providers
all_providers = api_providers()
providers_for_api = all_providers[Api(args.api)]

View file

@ -12,7 +12,7 @@ import pkg_resources
import yaml
from llama_stack.cli.subcommand import Subcommand
from llama_stack.core.datatypes import * # noqa: F403
from llama_stack.distribution.datatypes import * # noqa: F403
class StackRun(Subcommand):
@ -47,7 +47,7 @@ class StackRun(Subcommand):
)
def _run_stack_run_cmd(self, args: argparse.Namespace) -> None:
from llama_stack.common.exec import run_with_pty
from llama_stack.distribution.utils.exec import run_with_pty
if not args.config:
self.parser.error("Must specify a config file to run")
@ -68,13 +68,13 @@ class StackRun(Subcommand):
if config.docker_image:
script = pkg_resources.resource_filename(
"llama_stack",
"core/start_container.sh",
"distribution/start_container.sh",
)
run_args = [script, config.docker_image]
else:
script = pkg_resources.resource_filename(
"llama_stack",
"core/start_conda_env.sh",
"distribution/start_conda_env.sh",
)
run_args = [
script,