{"id":19825923,"url":"https://github.com/martinkalema/bentoml-test","last_synced_at":"2025-07-29T11:32:52.720Z","repository":{"id":231362146,"uuid":"781570326","full_name":"MartinKalema/bentoML-test","owner":"MartinKalema","description":"Learnt bentoML","archived":false,"fork":false,"pushed_at":"2024-04-03T18:31:33.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-28T15:45:09.221Z","etag":null,"topics":["bentoml","localstorage","mlops","rest-api"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MartinKalema.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-04-03T16:24:29.000Z","updated_at":"2024-04-03T18:07:27.000Z","dependencies_parsed_at":"2024-04-03T18:46:38.268Z","dependency_job_id":null,"html_url":"https://github.com/MartinKalema/bentoML-test","commit_stats":null,"previous_names":["martinkalema/bentoml-test"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MartinKalema/bentoML-test","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MartinKalema%2FbentoML-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MartinKalema%2FbentoML-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MartinKalema%2FbentoML-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MartinKalema%2FbentoML-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MartinKalema","download_url":"https://codeload.github.com/MartinKalema/bentoML-test/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MartinKalema%2FbentoML-test/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267678448,"owners_count":24126333,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bentoml","localstorage","mlops","rest-api"],"created_at":"2024-11-12T11:09:03.168Z","updated_at":"2025-07-29T11:32:52.694Z","avatar_url":"https://github.com/MartinKalema.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"### BentoML\n\nBentoML is an open-source platform for serving, managing, and deploying machine learning models. It allows you to package trained models with their dependencies into a format that can be easily deployed and managed in various production environments.\n\nBentoML provides a unified interface for serving machine learning models via REST API endpoints and web applications. It supports popular ML frameworks like TensorFlow, PyTorch, Scikit-learn, XGBoost, and others.\n\nIts used during model training, and saves different model versions to your local storage which can be retrieved and used by creating a service.\n\n### CLI\n\n- Create a virtual environment\n\n```bash\nconda create -p venv python==3.9 -y\n```\n\n- Activate the environment\n\n```bash\nconda activate venv/\n```\n\n- Install dependencies\n\n```bash\npip install bentoml scikit-learn pandas\n```\n\n- Create a `download_model.py` file as shown below.\n\n```python\nimport bentoml\n\nfrom sklearn import svm\nfrom sklearn import datasets\n\n# Load training data set\niris = datasets.load_iris()\nX, y = iris.data, iris.target\n\n# Train the model\nclf = svm.SVC(gamma='scale')\nclf.fit(X, y)\n\n# Save model to the BentoML local Model Store\nsaved_model = bentoml.sklearn.save_model(\"iris_clf\", clf)\n```\n\n- Run the script to download the model\n\n```bash\npython download_model.py\n```\n\n- The model is now saved in the Model Store with the name iris_clf and an automatically generated version. You can retrieve this model later by using the name and version to create a BentoML Service. Run the command below to view all the available models in the Model Store.\n\n```bash\nbentoml models list\n\n```\n\n- Create a bentoML service and a model Runner by creating the file below named `service.py`.\n\n```python\nimport numpy as np\nimport bentoml\nfrom bentoml.io import NumpyNdarray\n\niris_clf_runner = bentoml.sklearn.get(\"iris_clf:latest\").to_runner()\n\nsvc = bentoml.Service(\"iris_classifier\", runners=[iris_clf_runner])\n\n@svc.api(input=NumpyNdarray(), output=NumpyNdarray())\ndef classify(input_series: np.ndarray) -\u003e np.ndarray:\n    result = iris_clf_runner.predict.run(input_series)\n    return result\n```\n\n- Run the service\n\n```bash\nbentoml serve service:svc\n\n```\n\n- Build a bento\n  After the Service is ready, you can package it into a Bento by specifying a configuration YAML file (`bentofile.yaml`) that defines the build options.\n\n```bash\nservice: \"service:svc\"  # Same as the argument passed to `bentoml serve`\nlabels:\n   owner: bentoml-team\n   stage: dev\ninclude:\n- \"*.py\"  # A pattern for matching which files to include in the Bento\npython:\n   packages:  # Additional pip packages required by the Service\n   - scikit-learn\n   - pandas\nmodels: # The model to be used for building the Bento.\n- iris_clf:latest\n```\n\n- Run `bentoml build` in your project directory to build the Bento.\n\n```bash\nbentoml build\n```\n\n- View all available bentos\n\n```bash\nbentoml list\n\n```\n\n- Deploy a bento\n\n```bash\nbentoml containerize iris_classifier:latest\n```\n\nNext steps:\n\n- Deploy to BentoCloud:\n\n  ```bash\n  bentoml deploy iris_classifier:ojx7ofxr46mocxha -n ${DEPLOYMENT_NAME}\n  ```\n\n- Update an existing deployment on BentoCloud:\n\n  ```bash\n  bentoml deployment update --bento iris_classifier:ojx7ofxr46mocxha ${DEPLOYMENT_NAME}\n  ```\n\n- Containerize your Bento with `bentoml containerize`:\n\n  ```bash\n  bentoml containerize iris_classifier:ojx7ofxr46mocxha [or bentoml build --containerize]\n  ```\n\n- Push to BentoCloud with `bentoml push`:\n  ```bash\n  bentoml push iris_classifier:ojx7ofxr46mocxha [or bentoml build --push]\n  ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinkalema%2Fbentoml-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmartinkalema%2Fbentoml-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinkalema%2Fbentoml-test/lists"}