-
Notifications
You must be signed in to change notification settings - Fork 3
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 #13 from mlops-club/feature/onboarding-instructions
Added onboarding instructions
- Loading branch information
Showing
58 changed files
with
1,171 additions
and
1,969 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
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 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 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 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 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,3 @@ | ||
{ | ||
"bentoml.bentomlHomeDir": "~/bentoml" | ||
} |
4 changes: 2 additions & 2 deletions
4
...ls/clearml-playground-workspace/README.md → bentoml-playground-workspace/README.md
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,7 +1,7 @@ | ||
# `clearml-playground-workspace` | ||
# `bentoml-playground-workspace` | ||
|
||
If you press `F5` to debug this extension, it will open up a development VS Code window | ||
with | ||
|
||
- the version of `clearml-session-manager` in this repo, activated | ||
- the version of the `vscode-bentoml` extension in this repo, activated | ||
- this folder as the workspace |
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,3 @@ | ||
docker: | ||
python_version: 3.10 | ||
docker_base_image: "python:3.11-slim" |
File renamed without changes.
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,37 @@ | ||
# BentoML Sklearn Example: Linear Regression | ||
|
||
0. Install dependencies: | ||
|
||
```bash | ||
pip install -r ./requirements.txt | ||
``` | ||
|
||
1. Train a linear regression model | ||
|
||
```bash | ||
python ./train.py | ||
``` | ||
|
||
2. Run the service: | ||
|
||
```bash | ||
bentoml serve service.py:svc | ||
``` | ||
|
||
3. Send test request | ||
|
||
``` | ||
curl -X POST -H "content-type: application/json" --data "[[5, 3]]" http://127.0.0.1:3000/predict | ||
``` | ||
|
||
4. Build Bento | ||
|
||
``` | ||
bentoml build | ||
``` | ||
|
||
5. Build docker image | ||
|
||
``` | ||
bentoml containerize linear_regression:latest | ||
``` |
5 changes: 5 additions & 0 deletions
5
bentoml-playground-workspace/linear_regression/bentofile.yaml
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,5 @@ | ||
service: "service.py:svc" | ||
include: | ||
- "service.py" | ||
python: | ||
requirements_txt: "./requirements.txt" |
2 changes: 2 additions & 0 deletions
2
bentoml-playground-workspace/linear_regression/requirements.txt
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,2 @@ | ||
bentoml>=1.0.0 | ||
scikit-learn |
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,13 @@ | ||
import bentoml | ||
from bentoml.io import NumpyNdarray | ||
|
||
reg_runner = bentoml.sklearn.get("linear_reg:latest").to_runner() | ||
|
||
svc = bentoml.Service("linear_regression", runners=[reg_runner]) | ||
|
||
input_spec = NumpyNdarray(dtype="int", shape=(-1, 2)) | ||
|
||
|
||
@svc.api(input=input_spec, output=NumpyNdarray()) | ||
async def predict(input_arr): | ||
return await reg_runner.predict.async_run(input_arr) |
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,16 @@ | ||
from sklearn import linear_model | ||
|
||
import bentoml | ||
|
||
if __name__ == "__main__": | ||
reg = linear_model.LinearRegression() | ||
reg.fit([[0, 0], [1, 1], [2, 2]], [0, 1, 2]) | ||
|
||
print("coef: ", reg.coef_) | ||
bento_model = bentoml.sklearn.save_model("linear_reg", reg) | ||
print(f"Model saved: {bento_model}") | ||
|
||
# Test running inference with BentoML runner | ||
test_runner = bentoml.sklearn.get("linear_reg:latest").to_runner() | ||
test_runner.init_local() | ||
assert test_runner.predict.run([[1, 1]]) == reg.predict([[1, 1]]) |
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.