Move files
This commit is contained in:
parent
b97b20ba88
commit
c046d64a98
16 changed files with 35 additions and 36 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
"""GreatAI"""
|
"""GreatAI."""
|
||||||
__version__ = "0.1.0"
|
__version__ = "0.1.1"
|
||||||
|
|
||||||
|
|
||||||
from .context import configure
|
from .context import configure
|
||||||
|
|
@ -10,15 +10,17 @@ from .errors import (
|
||||||
RemoteCallError,
|
RemoteCallError,
|
||||||
WrongDecoratorOrderError,
|
WrongDecoratorOrderError,
|
||||||
)
|
)
|
||||||
from .models import save_model, use_model
|
from .models.save_model import save_model
|
||||||
from .output_views import (
|
from .models.use_model import use_model
|
||||||
ClassificationOutput,
|
|
||||||
MultiLabelClassificationOutput,
|
|
||||||
RegressionOutput,
|
|
||||||
)
|
|
||||||
from .parameters.log_metric import log_metric
|
from .parameters.log_metric import log_metric
|
||||||
from .parameters.parameter import parameter
|
from .parameters.parameter import parameter
|
||||||
from .persistence import MongodbDriver, ParallelTinyDbDriver, TracingDatabaseDriver
|
from .persistence import MongodbDriver, ParallelTinyDbDriver, TracingDatabaseDriver
|
||||||
from .remote import call_remote_great_ai, call_remote_great_ai_async
|
from .remote import call_remote_great_ai, call_remote_great_ai_async
|
||||||
from .tracing import add_ground_truth, delete_ground_truth, query_ground_truth
|
from .tracing import add_ground_truth, delete_ground_truth, query_ground_truth
|
||||||
from .views import RouteConfig, Trace
|
from .views import (
|
||||||
|
ClassificationOutput,
|
||||||
|
MultiLabelClassificationOutput,
|
||||||
|
RegressionOutput,
|
||||||
|
RouteConfig,
|
||||||
|
Trace,
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ from tqdm.cli import tqdm
|
||||||
from ..constants import DASHBOARD_PATH
|
from ..constants import DASHBOARD_PATH
|
||||||
from ..context import get_context
|
from ..context import get_context
|
||||||
from ..helper import freeze_arguments, get_function_metadata_store, snake_case_to_text
|
from ..helper import freeze_arguments, get_function_metadata_store, snake_case_to_text
|
||||||
from ..models import model_versions
|
from ..models.use_model import model_versions
|
||||||
from ..parameters.automatically_decorate_parameters import (
|
from ..parameters.automatically_decorate_parameters import (
|
||||||
automatically_decorate_parameters,
|
automatically_decorate_parameters,
|
||||||
)
|
)
|
||||||
|
|
@ -58,7 +58,10 @@ class GreatAI(Generic[T, V]):
|
||||||
self._wrapped_func = wraps(func)(freeze_arguments(self._cached_func))
|
self._wrapped_func = wraps(func)(freeze_arguments(self._cached_func))
|
||||||
|
|
||||||
wraps(func)(self)
|
wraps(func)(self)
|
||||||
self.__doc__ = f"GreatAI wrapper for interacting with the `{self.__name__}` function.\n\n{dedent(self.__doc__ or '')}"
|
self.__doc__ = (
|
||||||
|
f"GreatAI wrapper for interacting with the `{self.__name__}` "
|
||||||
|
+ f"function.\n\n{dedent(self.__doc__ or '')}"
|
||||||
|
)
|
||||||
|
|
||||||
self.version = str(get_context().version)
|
self.version = str(get_context().version)
|
||||||
flat_model_versions = ".".join(f"{k}-v{v}" for k, v in model_versions)
|
flat_model_versions = ".".join(f"{k}-v{v}" for k, v in model_versions)
|
||||||
|
|
@ -79,7 +82,7 @@ class GreatAI(Generic[T, V]):
|
||||||
@overload
|
@overload
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def create( # type: ignore
|
def create( # type: ignore
|
||||||
# "Overloaded function signatures 1 and 2 overlap with incompatible return types"
|
# Overloaded function signatures 1 and 2 overlap with incompatible return types
|
||||||
# https://github.com/python/mypy/issues/12759
|
# https://github.com/python/mypy/issues/12759
|
||||||
func: Callable[..., Awaitable[V]],
|
func: Callable[..., Awaitable[V]],
|
||||||
) -> "GreatAI[Awaitable[Trace[V]], V]":
|
) -> "GreatAI[Awaitable[Trace[V]], V]":
|
||||||
|
|
@ -131,8 +134,8 @@ class GreatAI(Generic[T, V]):
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
A GreatAI instance wrapping `func`.
|
A GreatAI instance wrapping `func`.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return GreatAI[Trace[V], V](
|
return GreatAI[Trace[V], V](
|
||||||
func,
|
func,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -206,10 +206,6 @@ main > header .placeholder {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
main > footer {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
main > footer {
|
main > footer {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
from .freeze_arguments import freeze, freeze_arguments
|
from .freeze_arguments import freeze, freeze_arguments
|
||||||
from .get_arguments import get_arguments
|
from .get_arguments import get_arguments
|
||||||
from .get_function_metadata_store import get_function_metadata_store
|
from .get_function_metadata_store import get_function_metadata_store
|
||||||
from .hashable_base_model import HashableBaseModel
|
|
||||||
from .snake_case_to_text import snake_case_to_text
|
from .snake_case_to_text import snake_case_to_text
|
||||||
from .strip_lines import strip_lines
|
from .strip_lines import strip_lines
|
||||||
from .text_to_hex_color import text_to_hex_color
|
from .text_to_hex_color import text_to_hex_color
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ from typing import Any, Callable, Dict, Mapping, Sequence
|
||||||
def get_arguments(
|
def get_arguments(
|
||||||
func: Callable, args: Sequence[Any], kwargs: Mapping[str, Any]
|
func: Callable, args: Sequence[Any], kwargs: Mapping[str, Any]
|
||||||
) -> Dict[str, Any]:
|
) -> Dict[str, Any]:
|
||||||
"""Return mapping from parameter names to actual argument values"""
|
"""Return mapping from parameter names to actual argument values."""
|
||||||
|
|
||||||
signature = inspect.signature(func)
|
signature = inspect.signature(func)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
from .save_model import save_model
|
|
||||||
from .use_model import model_versions, use_model
|
|
||||||
|
|
@ -32,17 +32,13 @@ def use_model(
|
||||||
) -> Callable[[F], F]:
|
) -> Callable[[F], F]:
|
||||||
"""Inject a model into a function.
|
"""Inject a model into a function.
|
||||||
|
|
||||||
Load a model specified by `key` and `version` using the
|
Load a model specified by `key` and `version` using the currently active `LargeFile`
|
||||||
currently active `LargeFile` implementation. If it's a
|
implementation. If it's a single object, it is deserialised using `dill`. If it's a
|
||||||
single object, it is deserialised using `dill`. If it's
|
directory of files, a `pathlib.Path` instance is given.
|
||||||
a directory of files, a `pathlib.Path` instance is given.
|
|
||||||
|
|
||||||
By default, the function's `model` parameter is replaced
|
By default, the function's `model` parameter is replaced by the loaded model. This
|
||||||
by the loaded model. This can be customised by changing
|
can be customised by changing `model_kwarg_name`. Multiple models can be loaded by
|
||||||
`model_kwarg_name`.
|
decorating the same function with `use_model` multiple times.
|
||||||
|
|
||||||
Multiple models can be loaded by decorating the same
|
|
||||||
function with `use_model` multiple times.
|
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
>>> from great_ai import save_model
|
>>> from great_ai import save_model
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,11 @@ from .function_metadata import FunctionMetadata
|
||||||
from .health_check_response import HealthCheckResponse
|
from .health_check_response import HealthCheckResponse
|
||||||
from .model import Model
|
from .model import Model
|
||||||
from .operators import operators
|
from .operators import operators
|
||||||
|
from .outputs import (
|
||||||
|
ClassificationOutput,
|
||||||
|
MultiLabelClassificationOutput,
|
||||||
|
RegressionOutput,
|
||||||
|
)
|
||||||
from .query import Query
|
from .query import Query
|
||||||
from .route_config import RouteConfig
|
from .route_config import RouteConfig
|
||||||
from .sort_by import SortBy
|
from .sort_by import SortBy
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
from typing import Any, Optional, Union
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
from ..helper import HashableBaseModel
|
from ..hashable_base_model import HashableBaseModel
|
||||||
|
|
||||||
|
|
||||||
class ClassificationOutput(HashableBaseModel):
|
class ClassificationOutput(HashableBaseModel):
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
from ..helper import HashableBaseModel
|
from ..hashable_base_model import HashableBaseModel
|
||||||
from .classification_output import ClassificationOutput
|
from .classification_output import ClassificationOutput
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
from typing import Any, Optional, Union
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
from ..helper import HashableBaseModel
|
from ..hashable_base_model import HashableBaseModel
|
||||||
|
|
||||||
|
|
||||||
class RegressionOutput(HashableBaseModel):
|
class RegressionOutput(HashableBaseModel):
|
||||||
|
|
@ -3,7 +3,7 @@ from typing import Any, Dict, Generic, List, Optional, TypeVar
|
||||||
|
|
||||||
from pydantic import Extra
|
from pydantic import Extra
|
||||||
|
|
||||||
from ..helper import HashableBaseModel
|
from .hashable_base_model import HashableBaseModel
|
||||||
from .model import Model
|
from .model import Model
|
||||||
|
|
||||||
T = TypeVar("T")
|
T = TypeVar("T")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue