Skip to main content

classy.scripts.cli.utils

Functions

autocomplete_model_path

def autocomplete_model_path(
    prefix: str,
    **kwargs,
)

checkpoint_path_from_user_input

def checkpoint_path_from_user_input(
    model_path: str,
) ‑> str

get_device

def get_device(
    device,
)

import_module_and_submodules

def import_module_and_submodules(
    package_name: str,
    exclude: Optional[Set[str]] = None,
) ‑> None

Import all submodules under the given package. Primarily useful so that people using classy as a library can specify their own custom packages and have their custom classes get loaded and registered.

maybe_find_directory

def maybe_find_directory(
    possible_names,
) ‑> Optional[str]

push_python_path

def push_python_path(
    path,
)

Prepends the given path to sys.path. This method is intended to use with with, so after its usage, its value willbe removed fromsys.path.

try_get_checkpoint_path_from_user_input

def try_get_checkpoint_path_from_user_input(
    model_path: str,
) ‑> Optional[str]