Skip to content

Commit

Permalink
docs: Update the quickstart (#4474)
Browse files Browse the repository at this point in the history
* Update the quickstart

Signed-off-by: Sherlock113 <[email protected]>

* Add cd command

Signed-off-by: Sherlock113 <[email protected]>

---------

Signed-off-by: Sherlock113 <[email protected]>
  • Loading branch information
Sherlock113 authored Feb 2, 2024
1 parent e978121 commit 9169155
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
12 changes: 6 additions & 6 deletions docs/source/get-started/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ In a typical ML workflow, you may need to prepare the data for your model, train

The following is the basic workflow of using the BentoML framework.

1. Model registry
^^^^^^^^^^^^^^^^^
1. Model registration
^^^^^^^^^^^^^^^^^^^^^

The first step in using BentoML is to save your model in the BentoML Model Store, a centralized repository for managing all local models. BentoML is compatible with a variety of models, including pre-trained models from Hugging Face or custom models trained on your custom datasets. The Model Store simplifies the process of iterating and evaluating different model versions, providing an efficient way to track and manage your ML assets.
To get started, you can save your model in the BentoML :doc:`/guides/model-store`, a centralized repository for managing all local models. BentoML is compatible with a variety of models, including pre-trained models from Hugging Face or custom models trained on your custom datasets. The Model Store simplifies the process of iterating and evaluating different model versions, providing an efficient way to track and manage your ML assets.

Note that for simple use cases, you can skip this step and use pre-trained models directly when creating your BentoML Service.
Note that for simple use cases, you can **skip this step** and use pre-trained models directly when creating your BentoML Service.

2. Service creation
^^^^^^^^^^^^^^^^^^^
Expand All @@ -72,5 +72,5 @@ You create BentoML :doc:`/guides/services` by defining a ``service.py`` file, wh

Before deploying your AI application, you create a ``bentofile.yaml`` file, detailing all necessary build configurations such as Python dependencies and Docker settings. After that, you can choose either of the following ways to deploy your application.

- With a single command, you deploy your application to BentoCloud. In this approach, your project is automatically packaged into a Bento, the standard distribution format for BentoML Services, uploaded and deployed on BentoCloud. This serverless platform offers scalable and hardware-optimized solutions for running AI applications.
- You can manually package your project into a Bento and containerize it as a Docker image. This Docker image can then be deployed to any Docker-compatible environment, such as Kubernetes. This method provides more flexibility in deployment and is suitable for integration into your existing container orchestration system.
- With a single command, you :doc:`deploy your application to BentoCloud </guides/deployment>`. In this approach, your project is automatically packaged into a Bento, the standard distribution format for BentoML Services, uploaded and deployed on BentoCloud. This serverless platform offers scalable and hardware-optimized solutions for running AI applications.
- You can manually package your project into a Bento and :doc:`containerize it as a Docker image </guides/containerization>`. This Docker image can then be deployed to any Docker-compatible environment, such as Kubernetes. This method provides more flexibility in deployment and is suitable for integration into your existing container orchestration system.
17 changes: 9 additions & 8 deletions docs/source/get-started/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,18 @@ Prerequisites
Install dependencies
--------------------

Run the following command to install the required dependencies.
Run the following command to clone the repository and install the required dependencies.

.. code-block:: bash
pip install bentoml --pre
pip install transformers torch
git clone https://github.com/bentoml/quickstart.git
cd quickstart
pip install -r requirements.txt
Create a BentoML Service
------------------------

You can define the serving logic of the model in a ``service.py`` file by creating a BentoML Service as below.
You can define the serving logic of the model in a ``service.py`` file by creating a BentoML Service. Here is the example file in this project:

.. code-block:: python
:caption: `service.py`
Expand Down Expand Up @@ -64,16 +65,16 @@ You can define the serving logic of the model in a ``service.py`` file by creati
In BentoML, a :doc:`Service </guides/services>` is a deployable and scalable unit, defined as a Python class with the ``@bentoml.service`` decorator. It can manage states and their lifecycle, and expose one or multiple APIs accessible through HTTP. Each API within the Service is defined using the ``@bentoml.api`` decorator, specifying it as a Python function.

In the ``Summarization`` class, the Service retrieves a pre-trained model (``sshleifer/distilbart-cnn-12-6``) from the Hugging Face hub and initializes a pipeline for text summarization. The ``summarize`` method serves as the API endpoint. In this example, it accepts a string input with an example provided, processes it through the pipeline, and returns the summarized text.
In the ``Summarization`` class, the Service retrieves a pre-trained model (``sshleifer/distilbart-cnn-12-6``) from the Hugging Face hub and initializes a pipeline for text summarization. The ``summarize`` method serves as the API endpoint. In this example, it accepts a string input with a sample provided, processes it through the pipeline, and returns the summarized text.

Run ``bentoml serve service:<service_class_name>`` in your project directory to start the BentoML server.

.. code-block:: bash
$ bentoml serve service:Summarization
2023-12-18T06:51:51+0000 [INFO] [cli] Prometheus metrics for HTTP BentoServer from "service:Summarization" can be accessed at http://localhost:3000/metrics.
2023-12-18T06:51:51+0000 [INFO] [cli] Starting production HTTP BentoServer from "service:Summarization" listening on http://localhost:3000 (Press CTRL+C to quit)
2024-02-02T07:16:14+0000 [WARNING] [cli] Converting 'Summarization' to lowercase: 'summarization'.
2024-02-02T07:16:15+0000 [INFO] [cli] Starting production HTTP BentoServer from "service:Summarization" listening on http://localhost:3000 (Press CTRL+C to quit)
The server is active at http://localhost:3000. You can interact with it in different ways.

Expand Down Expand Up @@ -114,4 +115,4 @@ Expected output:
Whiskers, an otherwise unremarkable tabby cat, jumped a record-breaking 20 feet into the air to catch a fly . The event is now being investigated by scientists for potential breaches in the laws of physics . Local authorities considering a town festival to celebrate what is being hailed as 'The Leap of the Century'
Once the Service is ready, you can deploy this BentoML project on BentoCloud or :doc:`create a Docker image </guides/containerization>` for it and ship it anywhere.
Once the Service is ready, you can deploy this :doc:`BentoML project on BentoCloud </guides/deployment>` or :doc:`create a Docker image </guides/containerization>` for it and ship it anywhere.

0 comments on commit 9169155

Please sign in to comment.