utils

Methods

unison_shuffled_copies

  1. def unison_shuffled_copies(a, b)

get_list_subset

  1. def get_list_subset(target: List, index_list: List[int]) -> List

custom_object_scope

  1. def custom_object_scope()

load_model

Load saved model from saved model from model.save function

  1. def load_model(model_path: str, load_weights: bool = True) -> BaseModel

Args:

  • model_path: model folder path
  • load_weights: only load model structure and vocabulary when set to False, default True.

Returns:

load_processor

  1. def load_processor(model_path: str) -> BaseProcessor

Load processor from model, When we using tf-serving, we need to use model’s processor to pre-process data

Args: model_path:

Returns:

convert_to_saved_model

Export model for tensorflow serving

  1. def convert_to_saved_model(model: BaseModel,
  2. model_path: str,
  3. version: str = None,
  4. inputs: Optional[Dict] = None,
  5. outputs: Optional[Dict] = None):

Args:

  • model: Target model
  • model_path: The path to which the SavedModel will be stored.
  • version: The model version code, default timestamp
  • inputs: dict mapping string input names to tensors. These are added to the SignatureDef as the inputs.
  • outputs: dict mapping string output names to tensors. These are added to the SignatureDef as the outputs.