Serialization#

libserving.serialization.save_knn(path: str, model: CfBase, k: int)[source]#

Save KNN model to disk.

Parameters:
  • path (str) – Model saving path.

  • model (CfBase) – Model to save.

  • k (int) – Number of similar users/items to save.

libserving.serialization.save_embed(path: str, model: EmbedBase)[source]#

Save Embed model to disk.

Parameters:
  • path (str) – Model saving path.

  • model (EmbedBase) – Model to save.

libserving.serialization.save_tf(path: str, model: TfBase, version: int = 1)[source]#

Save TF model to disk.

Parameters:
  • path (str) – Model saving path.

  • model (TfBase) – Model to save.

  • version (int, default: 1) – Version number used in tf.saved_model.

libserving.serialization.save_online(path: str, model: DynEmbedBase | TfBase, version: int = 1)[source]#

Save online computing model to disk.

Parameters:
  • path (str) – Model saving path.

  • model (Union[DynEmbedBase, TfBase]) – Model to save.

  • version (int, default: 1) – Version number used in tf.saved_model.

libserving.serialization.knn2redis(path: str, host: str = 'localhost', port: int = 6379, db: int = 0)[source]#

Save KNN model to redis.

Parameters:
  • path (str) – Model saving path.

  • host (str, default: "localhost") – Redis host.

  • port (int, default: 6379) – Redis port

  • db (int, default: 0) – Redis db number

libserving.serialization.embed2redis(path: str, host: str = 'localhost', port: int = 6379, db: int = 0)[source]#

Save Embed model to redis.

Parameters:
  • path (str) – Model saving path.

  • host (str, default: "localhost") – Redis host.

  • port (int, default: 6379) – Redis port

  • db (int, default: 0) – Redis db number

libserving.serialization.tf2redis(path: str, host: str = 'localhost', port: int = 6379, db: int = 0)[source]#

Save TF model to redis.

Parameters:
  • path (str) – Model saving path.

  • host (str, default: "localhost") – Redis host.

  • port (int, default: 6379) – Redis port

  • db (int, default: 0) – Redis db number

libserving.serialization.online2redis(path: str, host: str = 'localhost', port: int = 6379, db: int = 0)[source]#

Save online computing model to redis.

Parameters:
  • path (str) – Model saving path.

  • host (str, default: "localhost") – Redis host.

  • port (int, default: 6379) – Redis port

  • db (int, default: 0) – Redis db number