botiverse.bots.ConverseBot package#

Submodules#

botiverse.bots.ConverseBot.ConverseBot module#

class botiverse.bots.ConverseBot.ConverseBot.ConverseBot(from_scratch=False)[source]#

Bases: object

An interface for the ConverseBot model which is a conversational model based on the Flan-T5 model

Initializes a ConverseBot instance and loads the Backend finetuning parameters, and optionally gets the training dataset if a frontend finetuning is desired.

Parameters:

from_scratch (Boolean, optional) – Boolean flag to indicate whether to load a model verstion that is made from scratch (recommended to be False)

Returns:

None

read_data(file_path)[source]#

Reads and pre-processes the data, sets up the model based on the data and prepares the train-validation split.

Parameters:

file_path (str) – The path to the file that contains the dataset.

Returns:

None

train(epochs=1, batch_size=1)[source]#

Trains the model on the input dataset.

Parameters:
  • epochs (int, optional) – Number of epochs to train for.

  • batch_size (int, optional) – The size of the training batches.

Returns:

None

validation(batch_size=1)[source]#

Validates the model on the validation dataset.

Parameters:

batch_size (int, optional) – The size of the validation batches.

Returns:

None

infer(string, temperature=1)[source]#

Inference on the model using the input string.

Parameters:
  • string (str) – The string to provide for inference.

  • temperature (float, optional) – The temperature of the softmax function, the higher its value the flatter the probability distribution of the next token will be.

Returns:

Inference result from the model.

Return type:

str

save(path)[source]#

Save the model locally to the provided path.

Parameters:

path (str) – The path where to save the model.

Returns:

None

load(path)[source]#

Load the model from the provided path.

Parameters:

path (str) – The path where to load the model from.

Returns:

None

Module contents#