import torch


def load_waveglow_model(waveglow_path):
    """
    Loads the Waveglow model.
    Uses GPU if available, otherwise uses CPU.

    Parameters
    ----------
    waveglow_path : str
        Path to waveglow model

    Returns
    -------
    Torch
        Loaded waveglow model
    """
    waveglow = torch.load(waveglow_path)["model"]
    if torch.cuda.is_available():
        waveglow.cuda().eval().half()

    for k in waveglow.convinv:
        k.float()
    return waveglow