-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58 from truefoundry/audit-raja
adding deploy for customer-churn and readme changes
- Loading branch information
Showing
15 changed files
with
250 additions
and
645 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# getting-started-examples | ||
Examples to get started with using TrueFoundry | ||
|
||
Deployment of Job | ||
--- | ||
This example runs a Customer-churn for inferring using a classifier. | ||
Mainly this example shows how to deploy to TrueFoundry using a Pythonfile and TrueFoundry Python SDK. | ||
|
||
## Setup | ||
|
||
> For setup, please refer to the following documentation: | ||
> - [Create a ML Repo ](https://docs.truefoundry.com/docs/key-concepts#creating-an-ml-repo) | ||
> - [Grant Editor access to ML Repo](https://docs.truefoundry.com/docs/key-concepts#grant-access-of-ml-repo-to-workspace) | ||
## Run Locally | ||
|
||
1. Install requirements | ||
|
||
```shell | ||
python -m pip install -r requirements.txt | ||
``` | ||
|
||
2. Start the Customer-churn | ||
|
||
```shell | ||
python main.py --n_neighbors {{n_neighbors}} --weights {{weights}} --ml_repo {{ml_repo}} | ||
``` | ||
|
||
## Deploy with TrueFoundry | ||
|
||
1. Install `truefoundry` | ||
|
||
```shell | ||
python -m pip install -U "truefoundry>=0.4.1,<0.5.0" | ||
``` | ||
|
||
2. Login | ||
|
||
```shell | ||
tfy login --host "<Host name of TrueFoundry UI. e.g. https://company.truefoundry.cloud>" | ||
``` | ||
|
||
3. Deploy! | ||
|
||
> Please refer to following docs | ||
> - [Getting workspace FQN](https://docs.truefoundry.com/docs/key-concepts#getting-workspace-fqn) | ||
```shell | ||
python deploy.py --workspace-fqn <Workspace FQN> | ||
``` | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import logging | ||
import argparse | ||
|
||
from truefoundry.deploy import Build, PythonBuild, LocalSource, Param, Resources, Job | ||
|
||
logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(name)s] %(levelname)-8s %(message)s") | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument("--workspace_fqn", required=True, type=str) | ||
args = parser.parse_args() | ||
|
||
job = Job( | ||
name="churn-prediction-job", | ||
image=Build( | ||
build_source=LocalSource(local_build=False), | ||
build_spec=PythonBuild( | ||
python_version="3.11", | ||
command="python main.py --n_neighbors {{n_neighbors}} --weights {{weights}} --ml_repo {{ml_repo}}", | ||
requirements_path="requirements.txt", | ||
), | ||
), | ||
params=[ | ||
Param( | ||
name="n_neighbors", | ||
default=5, | ||
description="Number of neighbors to use by default", | ||
), | ||
Param( | ||
name="weights", | ||
default="uniform", | ||
description="Weight function used in prediction. Possible values: uniform, distance", | ||
), | ||
Param( | ||
name="ml_repo", | ||
param_type="ml_repo", | ||
description="ML Repo to log metrics and model to", | ||
), | ||
], | ||
resources=Resources( | ||
memory_limit=500, | ||
memory_request=500, | ||
ephemeral_storage_limit=600, | ||
ephemeral_storage_request=600, | ||
cpu_limit=0.3, | ||
cpu_request=0.3, | ||
), | ||
) | ||
|
||
deployment = job.deploy(workspace_fqn=args.workspace_fqn, wait=False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,46 @@ | ||
# getting-started-examples | ||
Examples to get started with using TrueFoundry | ||
|
||
Deployment | ||
--- | ||
This example runs a simple iris app for inferring using a iris classifier. | ||
Mainly this example shows how to deploy to TrueFoundry using a Pythonfile and TrueFoundry Python SDK. | ||
|
||
## Run Locally | ||
|
||
1. Install requirements | ||
|
||
```shell | ||
python -m pip install -r requirements.txt | ||
``` | ||
|
||
2. Start the iris app | ||
|
||
```shell | ||
python app.py | ||
``` | ||
|
||
## Deploy with TrueFoundry | ||
|
||
1. Install `truefoundry` | ||
|
||
```shell | ||
python -m pip install -U "truefoundry>=0.4.1,<0.5.0" | ||
``` | ||
|
||
2. Login | ||
|
||
```shell | ||
tfy login --host "<Host name of TrueFoundry UI. e.g. https://company.truefoundry.cloud>" | ||
``` | ||
|
||
3. Deploy! | ||
|
||
> Please refer to following docs | ||
> - [Getting workspace FQN](https://docs.truefoundry.com/docs/key-concepts#getting-workspace-fqn) | ||
> - [Get host and path for deploying applications](https://docs.truefoundry.com/docs/define-ports-and-domains#identifying-available-domains) | ||
```shell | ||
python deploy.py --name iris --workspace-fqn <Workspace FQN> --host <Ingress Host for the cluster> --path <optional path> | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.