Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bentoml/_internal/cloud/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ def get(self, name: str, version: str | None = None) -> ModelSchema:
"""Get a model from the remote model store
Args:
tag: The tag of the model to get
name: The tag of the model to get
Returns:
The model
Expand Down
1 change: 0 additions & 1 deletion src/bentoml/_internal/container/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ def __init__(
Initialize the OCI builder.
Args:
backend: The name of the OCI builder.
env: Environment variables to be passed to the OCI builder.
enable_buildkit: Whether to enable BuildKit support for given OCI builder.
build_cmd: The build command to be used by the OCI builder, minus the backend name.
Expand Down
2 changes: 1 addition & 1 deletion src/bentoml/_internal/frameworks/fastai.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def save_model(
Args:
name: The name to give to the model in the BentoML store. This must be a valid
:obj:`~bentoml.Tag` name.
learner: :obj:`~fastai.learner.Learner` to be saved.
learner_: :obj:`~fastai.learner.Learner` to be saved.
signatures: Signatures of predict methods to be used. If not provided, the signatures default to
``predict``. See :obj:`~bentoml.types.ModelSignature` for more details.
labels: A default set of management labels to be associated with the model. An example is ``{"training-set": "data-1"}``.
Expand Down
6 changes: 1 addition & 5 deletions src/bentoml/_internal/frameworks/pytorch_lightning.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,10 @@ def load_model(
Load a model from BentoML local modelstore with given name.

Args:
tag (:code:`Union[str, Tag]`):
bentoml_model (:code:`Union[str, Tag]`):
Tag of a saved model in BentoML local modelstore.
device_id (:code:`str`, `optional`):
Optional devices to put the given model on. Refer to https://pytorch.org/docs/stable/tensor_attributes.html#torch.torch.device
model_store (:mod:`~bentoml._internal.models.store.ModelStore`, default to :mod:`BentoMLContainer.model_store`):
BentoML modelstore, provided by DI Container.

Returns:
:obj:`torch.ScriptModule`: an instance of :obj:`torch.ScriptModule` from BentoML modelstore.
Expand Down Expand Up @@ -104,8 +102,6 @@ def save_model(
e.g. a tokenizer module, preprocessor module, model configuration module
metadata (:code:`Dict[str, Any]`, `optional`, default to :code:`None`):
Custom metadata for given model.
model_store (:mod:`~bentoml._internal.models.store.ModelStore`, default to :mod:`BentoMLContainer.model_store`):
BentoML modelstore, provided by DI Container.

Returns:
:obj:`~bentoml.Tag`: A :obj:`tag` with a format `name:version` where `name` is the user-defined model's name, and a generated `version` by BentoML.
Expand Down
2 changes: 1 addition & 1 deletion src/bentoml/_internal/frameworks/torchscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def load_model(
Load a model from BentoML local modelstore with given name.
Args:
tag:
bentoml_model:
Tag of a saved model in BentoML local modelstore.
device_id:
Optional devices to put the given model on. Refer to https://pytorch.org/docs/stable/tensor_attributes.html#torch.torch.device
Expand Down
1 change: 0 additions & 1 deletion src/bentoml/_internal/io_descriptors/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ def _from_sample(self, sample: t.Any) -> IOType:
Args:
sample: The sample to create the instance from.
**kwargs: Additional keyword arguments to pass to the constructor.
Returns:
An instance of the IODescriptor.
Expand Down
3 changes: 0 additions & 3 deletions src/bentoml/_internal/io_descriptors/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,6 @@ def _from_sample(self, sample: FileType | str) -> FileType:
Args:
sample: Given File-like object, or a path to a file.
kind: The kind of file-like object to be used. Currently, the only accepted value is ``binaryio``.
mime_type: Optional MIME type for the descriptor. If not provided, ``from_sample``
will try to infer the MIME type from the file extension.
Returns:
:class:`~bentoml._internal.io_descriptors.file.File`: IODescriptor from given users inputs.
Expand Down
5 changes: 0 additions & 5 deletions src/bentoml/_internal/io_descriptors/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,6 @@ def _from_sample(self, sample: ImageType | str) -> ImageType:
Args:
sample: Given File-like object, or a path to a file.
pilmode: Optional color mode for PIL. Default to ``RGB``.
mime_type: The MIME type of the file type that this descriptor should return.
If not specified, then ``from_sample`` will try to infer the MIME type
from file extension.
allowed_mime_types: An optional list of MIME types to restrict input to.
Returns:
:class:`~bentoml._internal.io_descriptors.image.Image`: IODescriptor from given users inputs.
Expand Down
1 change: 0 additions & 1 deletion src/bentoml/_internal/io_descriptors/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ class IrisFeatures(BaseModel):
@svc.api(input=input_spec, output=NumpyNdarray())
async def predict(input: NDArray[np.int16]) -> NDArray[Any]:
return await runner.async_run(input)
json_encoder: Optional JSON encoder.
Returns:
:class:`~bentoml._internal.io_descriptors.json.JSON`: IODescriptor from given users inputs.
Expand Down
9 changes: 1 addition & 8 deletions src/bentoml/_internal/io_descriptors/numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,12 +433,6 @@ def _from_sample(self, sample: ext.NpNDArray | t.Sequence[t.Any]) -> ext.NpNDArr
Args:
sample: Given sample ``np.ndarray`` data. It also accepts a sequence-like data type that
can be converted to ``np.ndarray``.
enforce_dtype: Enforce a certain data type. :code:`dtype` must be specified at function
signature. If you don't want to enforce a specific dtype then change
:code:`enforce_dtype=False`.
enforce_shape: Enforce a certain shape. :code:`shape` must be specified at function
signature. If you don't want to enforce a specific shape then change
:code:`enforce_shape=False`.

Returns:
:class:`~bentoml._internal.io_descriptors.numpy.NumpyNdarray`: IODescriptor from given users inputs.
Expand Down Expand Up @@ -491,8 +485,7 @@ async def from_proto(self, field: pb.NDArray | bytes) -> ext.NpNDArray:
Process incoming protobuf request and convert it to ``numpy.ndarray``

Args:
request: Incoming RPC request message.
context: grpc.ServicerContext
field: Incoming RPC request message.

Returns:
``numpy.ndarray``: A ``np.array`` constructed from given protobuf message.
Expand Down
52 changes: 3 additions & 49 deletions src/bentoml/_internal/io_descriptors/pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,31 +347,6 @@ def _from_sample(self, sample: ext.PdDataFrame) -> ext.PdDataFrame:

Args:
sample: Given sample ``pd.DataFrame`` data
orient: Indication of expected JSON string format. Compatible JSON strings can be
produced by :func:`pandas.io.json.to_json()` with a corresponding orient value.
Possible orients are:

- :obj:`split` - :code:`dict[str, Any]` ↦ {``idx`` ↠ ``[idx]``, ``columns`` ↠ ``[columns]``, ``data`` ↠ ``[values]``}
- :obj:`records` - :code:`list[Any]` ↦ [{``column`` ↠ ``value``}, ..., {``column`` ↠ ``value``}]
- :obj:`index` - :code:`dict[str, Any]` ↦ {``idx`` ↠ {``column`` ↠ ``value``}}
- :obj:`columns` - :code:`dict[str, Any]` ↦ {``column`` ↠ {``index`` ↠ ``value``}}
- :obj:`values` - :code:`dict[str, Any]` ↦ Values arrays
- :obj:`table` - :code:`dict[str, Any]` ↦ {``schema``: { schema }, ``data``: { data }}
apply_column_names: Update incoming DataFrame columns. ``columns`` must be specified at
function signature. If you don't want to enforce a specific columns
name then change ``apply_column_names=False``.
enforce_dtype: Enforce a certain data type. `dtype` must be specified at function
signature. If you don't want to enforce a specific dtype then change
``enforce_dtype=False``.
enforce_shape: Enforce a certain shape. ``shape`` must be specified at function
signature. If you don't want to enforce a specific shape then change
``enforce_shape=False``.
default_format: The default serialization format to use if the request does not specify a ``Content-Type`` Headers.
It is also the serialization format used for the response. Possible values are:

- :obj:`json` - JSON text format (inferred from content-type ``"application/json"``)
- :obj:`parquet` - Parquet binary format (inferred from content-type ``"application/vnd.apache.parquet"``)
- :obj:`csv` - CSV text format (inferred from content-type ``"text/csv"``)

Returns:
:class:`~bentoml._internal.io_descriptors.pandas.PandasDataFrame`: IODescriptor from given users inputs.
Expand Down Expand Up @@ -640,8 +615,7 @@ async def from_proto(self, field: pb.DataFrame | bytes) -> ext.PdDataFrame:
Process incoming protobuf request and convert it to ``pandas.DataFrame``

Args:
request: Incoming RPC request message.
context: grpc.ServicerContext
field: Incoming RPC request message.

Returns:
a ``pandas.DataFrame`` object. This can then be used
Expand Down Expand Up @@ -698,7 +672,6 @@ async def _to_proto_impl(

Args:
obj: ``pandas.DataFrame`` that will be serialized to protobuf
context: grpc.aio.ServicerContext from grpc.aio.Server
Returns:
``service_pb2.Response``:
Protobuf representation of given ``pandas.DataFrame``
Expand Down Expand Up @@ -849,9 +822,6 @@ def predict(input_arr):
- :obj:`index` - :code:`dict[str, Any]` ↦ {``idx`` ↠ {``column`` ↠ ``value``}}
- :obj:`columns` - :code:`dict[str, Any]` ↦ {``column`` ↠ {``index`` ↠ ``value``}}
- :obj:`values` - :code:`dict[str, Any]` ↦ Values arrays
columns: List of columns name that users wish to update.
apply_column_names: Whether to update incoming DataFrame columns. If :code:`apply_column_names=True`,
then ``columns`` must be specified.
dtype: Data type users wish to convert their inputs/outputs to. If it is a boolean,
then pandas will infer dtypes. Else if it is a dictionary of column to
``dtype``, then applies those to incoming dataframes. If ``False``, then don't
Expand Down Expand Up @@ -898,21 +868,7 @@ def _from_sample(self, sample: ext.PdSeries | t.Sequence[t.Any]) -> ext.PdSeries
Create a :class:`~bentoml._internal.io_descriptors.pandas.PandasSeries` IO Descriptor from given inputs.

Args:
sample_input: Given sample ``pd.DataFrame`` data
orient: Indication of expected JSON string format. Compatible JSON strings can be
produced by :func:`pandas.io.json.to_json()` with a corresponding orient value.
Possible orients are:

- :obj:`split` - :code:`dict[str, Any]` ↦ {``idx`` ↠ ``[idx]``, ``columns`` ↠ ``[columns]``, ``data`` ↠ ``[values]``}
- :obj:`records` - :code:`list[Any]` ↦ [{``column`` ↠ ``value``}, ..., {``column`` ↠ ``value``}]
- :obj:`index` - :code:`dict[str, Any]` ↦ {``idx`` ↠ {``column`` ↠ ``value``}}
- :obj:`table` - :code:`dict[str, Any]` ↦ {``schema``: { schema }, ``data``: { data }}
enforce_dtype: Enforce a certain data type. `dtype` must be specified at function
signature. If you don't want to enforce a specific dtype then change
``enforce_dtype=False``.
enforce_shape: Enforce a certain shape. ``shape`` must be specified at function
signature. If you don't want to enforce a specific shape then change
``enforce_shape=False``.
sample: Given sample ``pd.DataFrame`` data

Returns:
:class:`~bentoml._internal.io_descriptors.pandas.PandasSeries`: IODescriptor from given users inputs.
Expand Down Expand Up @@ -1095,8 +1051,7 @@ async def from_proto(self, field: pb.Series | bytes) -> ext.PdSeries:
Process incoming protobuf request and convert it to ``pandas.Series``

Args:
request: Incoming RPC request message.
context: grpc.ServicerContext
field: Incoming RPC request message.

Returns:
a ``pandas.Series`` object. This can then be used
Expand Down Expand Up @@ -1157,7 +1112,6 @@ async def _to_proto_impl(

Args:
obj: ``pandas.Series`` that will be serialized to protobuf
context: grpc.aio.ServicerContext from grpc.aio.Server
Returns:
``service_pb2.Response``:
Protobuf representation of given ``pandas.Series``
Expand Down
2 changes: 1 addition & 1 deletion src/bentoml/_internal/models/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def to_runner(
name:
max_batch_size:
max_latency_ms:
runnable_method_configs:
method_configs:
Returns:
Expand Down
1 change: 0 additions & 1 deletion src/bentoml/_internal/utils/analytics/usage_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ def get_metrics_report(
Args:
metrics_client: Instance of bentoml._internal.server.metrics.prometheus.PrometheusClient
grpc: Whether the metrics are for gRPC server.
Returns:
A tuple of a list of metrics and an optional boolean to determine whether the return metrics are legacy metrics.
Expand Down
1 change: 0 additions & 1 deletion src/bentoml/bentos.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ def import_bento(
`FS URL documentation <https://docs.pyfilesystem.org/en/latest/openers.html>`_.
Args:
tag: the tag of the bento to export
path: can be one of two things:
* a folder on the local filesystem
* an `FS URL <https://docs.pyfilesystem.org/en/latest/openers.html>`_,
Expand Down
1 change: 0 additions & 1 deletion src/bentoml/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ def import_model(
`FS URL documentation <https://docs.pyfilesystem.org/en/latest/openers.html>`_.
Args:
tag: the tag of the model to export
path: can be one of two things:
* a folder on the local filesystem
* an `FS URL <https://docs.pyfilesystem.org/en/latest/openers.html>`_, for example :code:`'s3://my_bucket/folder/my_model.bentomodel'`
Expand Down
2 changes: 1 addition & 1 deletion src/bentoml/testing/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ def host_bento(
Host a bentoml service, yields the host URL.
Args:
bento: a bento tag or :code:`module_path:service`
bento_name: a bento tag or :code:`module_path:service`
project_path: the path to the project directory
config_file: the path to the config file
deployment_mode: the deployment mode, one of :code:`standalone`, :code:`docker` or :code:`distributed`
Expand Down