Artifacts

PickleArtifact

class bentoml.artifact.PickleArtifact(name, pickle_module=<module 'dill' from '/home/docs/checkouts/readthedocs.org/user_builds/bentoml/envs/latest/lib/python3.7/site-packages/dill/__init__.py'>, pickle_extension='.pkl')

Abstraction for saving/loading python objects with pickle serialization

Parameters:
  • name (str) – Name for the artifact
  • pickle_module (module|str) – The python module will be used for pickle and unpickle artifact
  • pickle_extension (str) – The extension format for pickled file.

TextFileArtifact

class bentoml.artifact.TextFileArtifact(name, file_extension='.txt', encoding='utf8')

Abstraction for saving/loading string to/from text files

Parameters:
  • name (str) – Name of the artifact
  • file_extension (str, optional) – The file extention used for the saved text file. Defaults to “.txt”
  • encoding (str) – The encoding will be used for saving/loading text. Defaults to “utf8”

PytorchModelArtifact

class bentoml.artifact.PytorchModelArtifact(name, file_extension='.pt')

Abstraction for saving/loading objects with torch.save and torch.load

XgboostModelArtifact

class bentoml.artifact.XgboostModelArtifact(name, model_extension='.model')

Abstraction for save/load object with Xgboost.

Parameters:
  • name (string) – name of the artifact
  • model_extension (string) – Extension name for saved xgboost model
Raises:

ImportError – xgboost package is required for using XgboostModelArtifact

FastaiModelArtifact

class bentoml.artifact.FastaiModelArtifact(name)

Saving and Loading FastAI Model

Parameters:

name (str) – Name for the fastai model

Raises:
  • ImportError – Require fastai package to use Fast ai model artifact
  • ValueError – Model is not instance of fast ai model

H2oModelArtifact

class bentoml.artifact.H2oModelArtifact(name)

Abstraction for saving/loading objects with h2o.save_model and h2o.load_model

Parameters:name (str) – Name for this h2o artifact..
Raises:ImportError – h2o package is required to use H2o model artifact

KerasModelArtifact

class bentoml.artifact.KerasModelArtifact(name, custom_objects=None, model_extension='.h5', store_as_json_and_weights=False)

Abstraction for saving/loading Keras model

Parameters:
  • name (string) – name of the artifact
  • custom_objects (dict) – dictionary of Keras custom objects for model
  • store_as_json_and_weights (bool) – flag allowing storage of the Keras model as JSON and weights