caikit.core.toolkit.serializers =============================== .. py:module:: caikit.core.toolkit.serializers .. autoapi-nested-parse:: Common serialization interfaces that are generally helpful for saving out models that are not necessarily specific to any domain's 3rd party libraries. Classes ------- .. autoapisummary:: caikit.core.toolkit.serializers.ObjectSerializer caikit.core.toolkit.serializers.JSONSerializer caikit.core.toolkit.serializers.TextSerializer caikit.core.toolkit.serializers.YAMLSerializer caikit.core.toolkit.serializers.CSVSerializer caikit.core.toolkit.serializers.PickleSerializer Module Contents --------------- .. py:class:: ObjectSerializer Bases: :py:obj:`abc.ABC` Abstract class for serializing an object to disk. .. py:method:: serialize(obj, file_path) :abstractmethod: Serialize the provided object to the specified file path. Args: obj (object): The object to serialize file_path (str): Absolute path to which the object should be serialized .. py:class:: JSONSerializer Bases: :py:obj:`ObjectSerializer` An ObjectSerializer for serializing to a JSON file. .. py:method:: serialize(obj, file_path) Serialize the provided object to a JSON file. Args: obj (object): The object to serialize file_path (str): Absolute path to which the object should be serialized .. py:class:: TextSerializer Bases: :py:obj:`ObjectSerializer` An ObjectSerializer for serializing a python list to a text file. .. py:method:: serialize(obj, file_path) Serialize the provided python list to a text file. Args: obj (list(str)): The list to serialize file_path (str): Absolute path to which the object should be serialized .. py:class:: YAMLSerializer Bases: :py:obj:`ObjectSerializer` An ObjectSerializer for serializing to a YAML file. .. py:method:: serialize(obj, file_path) Serialize the provided object to a YAML file. Args: obj (object): The object to serialize file_path (str): Absolute path to which the object should be serialized .. py:class:: CSVSerializer Bases: :py:obj:`ObjectSerializer` An ObjectSerializer for serializing to a CSV file. .. py:method:: serialize(obj, file_path) Serialize the provided object to a CSV file. Args: obj (object): The object to serialize file_path (str): Absolute path to which the object should be serialized .. py:class:: PickleSerializer Bases: :py:obj:`ObjectSerializer` An ObjectSerializer for pickling arbitrary Python objects. .. py:method:: serialize(obj, file_path) Serialize the provided object to a CSV file. Args: obj (any): The object to serialize file_path (str): Absolute path to which the object should be serialized