Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into docs-content
Browse files Browse the repository at this point in the history
  • Loading branch information
aguschin authored May 27, 2022
2 parents 63d58b2 + 3559cef commit e48e5d1
Show file tree
Hide file tree
Showing 24 changed files with 772 additions and 121 deletions.
36 changes: 20 additions & 16 deletions content/docs/api-reference/pack.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,33 @@ from mlem.api import pack
pack("pip", "rf", target="build", package_name="example_mlem_get_started")
```

> The extra kwargs supplied above can be seen from the output of
> `mlem types packager pip` which gives us
>
> ```py
> [required] package_name: str
> [required] target: str
> [not required] templates_dir: str = []
> [not required] python_version: str = None
> [not required] short_description: str = ""
> [not required] url: str = ""
> [not required] email: str = ""
> [not required] author: str = ""
> [not required] version: str = "0.0.0"
> [not required] additional_setup_kwargs: typing.Any = {}
> ```
## Description

This API is the underlying mechanism for the
[mlem pack](/doc/command-reference/pack) command and allows us to
programmatically create ship-able assets from MlemModels such as pip-ready
packages, docker images, etc.

<admon type="tip">

The arguments supplied to this method can be found with `mlem types`:

```cli
$ mlem types packager pip
[required] package_name: str
[required] target: str
[not required] templates_dir: str = []
[not required] python_version: str = None
[not required] short_description: str = ""
[not required] url: str = ""
[not required] email: str = ""
[not required] author: str = ""
[not required] version: str = "0.0.0"
[not required] additional_setup_kwargs: typing.Any = {}
```

</admon>

## Parameters

- **`packager`** (required) - Packager to use. Out-of-the-box supported string
Expand Down
8 changes: 6 additions & 2 deletions content/docs/command-reference/link.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@ Add a remote object to your local workspace (aka repo) without copying it
$ mlem link rf --source-repo https://github.com/iterative/example-mlem-get-started remote_model
```

> The remote model can now be served with the link created above, using the
> command `mlem serve remote_model fastapi`.
<admon type="tip">

The remote model can now be served with the link created above, using the
command `mlem serve remote_model fastapi`.

</admon>

Alias a local object with a different name

Expand Down
6 changes: 5 additions & 1 deletion content/docs/command-reference/pprint.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ specific information such as `methods` for a `model` or `reader` for a
Since only one specific object is printed, a `PATH` to the specific MLEM object
is always required.

> You can use [`mlem list`](/doc/command-reference/list) to list MLEM objects.
<admon type="tip">

You can use [`mlem list`](/doc/command-reference/list) to list MLEM objects.

</admon>

## Options

Expand Down
6 changes: 5 additions & 1 deletion content/docs/contributing/core.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ Make sure that you have Python 3.7 or higher installed. On macOS, we recommend
using `brew` to install Python. For Windows, we recommend an official
[python.org release](https://www.python.org/downloads/windows/).

> ℹ️ Note that `pip` version 20.3+ is required.
<admon type="info">

`pip` version 20.3+ is required.

</admon>

Install MLEM in editable mode with `pip install -e ".[tests]"`. But before we do
that, we **strongly** recommend creating a
Expand Down
47 changes: 33 additions & 14 deletions content/docs/get-started/deploying.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ You can create deployments in the cloud from your models. This uses packaging
and serving functions under the hood. For example, Heroku deployment combines
Docker image packaging with FastAPI serving.

> ⚠️ This functionality is experimental and is subject to change. We’ll add more
> target platforms in upcoming releases.
<admon type="warn">

Deployment often uses packaging and serving functionalities. For example, Heroku
deployment that is showcased in this section actually uses docker image
packaging with FastAPI serving.
This functionality is experimental and is subject to change.

</admon>

## Defining target environment

Expand All @@ -36,8 +35,12 @@ $ mlem create env heroku staging -c api_key=<you api key>
💾 Saving env to .mlem/env/staging.mlem
```

> Note that api_key argument is optional and MLEM will use `HEROKU_API_KEY` env
> variable if you don’t provide it via config.
<admon type="tip">

MLEM will attempt to use the `HEROKU_API_KEY` environment variable if no
`api_key` argument is provided.

</admon>

## Defining deployment

Expand Down Expand Up @@ -92,10 +95,18 @@ $ mlem deploy create myservice
✅ Service example-mlem-get-started is up. You can check it out at https://my-mlem-service.herokuapp.com/
```

> 💡 You can also create and configure deployment on-the-fly using `-c` options
> for `mlem deploy create` command:
>
> `$ mlem deploy create service_name -m model -t staging -c app_name=example-mlem-get-started`
<admon type="tip">

You can also define and run the deployment on-the-fly using `-c` options for
`mlem deploy create`, e.g.:

```cli
$ mlem deploy create myservice \
-m model -t staging \
-c app_name=example-mlem-get-started
```

</admon>

<details>

Expand Down Expand Up @@ -145,9 +156,17 @@ $ mlem deploy apply myservice test_x.csv --json
[1, 0, 2, 1, 1, 0, 1, 2, 1, 1, 2, 0, 0, 0, 0, 1, 2, 1, 1, 2, 0, 2, 0, 2, 2, 2, 2, 2, 0, 0, 0, 0, 1, 0, 0, 2, 1, 0]
```

> 💡 As always, you don’t need to have deployment meta locally:
>
> `$ mlem deploy apply https://github.com/iterative/example-mlem-get-started/myservice https://github.com/iterative/example-mlem-get-started/test_x.csv --json`
<admon type="tip">

You don’t even need to have the deployment metadata locally:

```cli
$ mlem deploy apply --json \
https://github.com/iterative/example-mlem-get-started/myservice \
https://github.com/iterative/example-mlem-get-started/test_x.csv
```

</admon>

## Managing deployment

Expand Down
12 changes: 9 additions & 3 deletions content/docs/get-started/saving.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,21 @@ Now let's run this script and see how we save the model.

```cli
$ python train.py
...
$ tree .mlem/model/
.mlem/model
├── rf
└── rf.mlem
```

> By default, MLEM saves your files to `.mlem/` directory, but that could be
> changed, see [project structure](/doc/user-guide/project-structure) for
> reference.
<admon type="tip">

By default, MLEM saves your files to `.mlem/` directory, but that can be
changed. See [Project Structure](/doc/user-guide/project-structure) for more
details.

</admon>

The model was saved along with some metadata about it: `rf` containing the model
binary and a `.mlem` metafile containing information about it. Let's take a look
Expand Down
14 changes: 9 additions & 5 deletions content/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@
It seamlessly supports a variety of scenarios like real-time serving and batch
processing.

> 💡 When combined with [GTO](https://github.com/iterative/gto), MLEM allows you
> to create a powerful Model Registry out of your Git repository! Such a
> registry serves as a centralized place to store and operationalize your models
> along with their metadata; manage model life-cycle, versions & releases, and
> easily automate tests and deployments using GitOps.
<admon type="tip">

When combined with [GTO](https://github.com/iterative/gto), MLEM allows you to
create a powerful Model Registry out of your Git repository! Such a registry
serves as a centralized place to store and operationalize your models along with
their metadata; manage model life-cycle, versions & releases, and easily
automate tests and deployments using GitOps.

</admon>

<cards>

Expand Down
Loading

0 comments on commit e48e5d1

Please sign in to comment.