import torch


def bluebert_load_model(bluebert_model_path: str):
    """
    Load fine-tuned Bluebert model.

    :param bluebert_model_path: directory with saved model
    :return: fine-tuned Bluebert Transformer model
    :return device: CPU vs GPU definition for torch
    """
    if torch.cuda.is_available():
        device = torch.device("cuda")
        print('There are ', torch.cuda.device_count(), ' GPU(s) available.')  # noqa: T001
        print('We will use the GPU:', torch.cuda.get_device_name(0))  # noqa: T001
    else:
        print('No GPU available, using the CPU instead.')  # noqa: T001
        device = torch.device("cpu")

    model = torch.load(bluebert_model_path, map_location=device)
    model.to(device)

    return model, device