from importlib import import_module


def create_vector_net_from_module(specific_class, model_module_name, labels):
    """
    Create a TextVectorNet model, or of its child class.

    - param specific_class(class): TextVectorNet or its child class.
    - param model_module_name(str): path to a local Python module in the working directory whose __init__.py file contains a get_vectorizer() callable, get_architecture() callable, and a get_state_dict_path() callable.
    - param labels(list of str): the classification labels, e.g. ["POSITIVE", "NEGATIVE"].
    """

    model_module = import_module(model_module_name)

    # Load the model by retrieving the inp-to-vec function, architecture, and state dict
    model = specific_class(
        model_module.get_vectorizer(),
        model_module.get_architecture(),
        model_module.get_state_dict_path(),
        labels,
    )

    return model