hearaudiomlp/kwmlp/common_api.py
def load_model(model_file_path: str) -> nn.Module:
    """Loads model weights from provided path.

    Args:
        model_file_path (str): Provided checkpoint path.

    Returns:
        nn.Module: Model instance.
    """

    embed_dim = 64
    scene_dim = 1024
    encoder_type = "kwmlp"

    model = AudioMLP_Wrapper(
        sample_rate=16000,
        timestamp_embedding_size=embed_dim,
        scene_embedding_size=scene_dim,
        encoder_type=encoder_type,
        encoder_ckpt=model_file_path
    )
    
    assert isinstance(model, nn.Module)
    assert hasattr(model, "sample_rate")
    assert hasattr(model, "timestamp_embedding_size")
    assert hasattr(model, "scene_embedding_size")
    
    device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
    model = model.to(device)
    model.eval()

    return model
Loads model weights from provided path.

    Args:
        model_file_path (str): Provided checkpoint path.

    Returns:
        nn.Module: Model instance.
    
Loads model weights from provided path.
Loads model weights from provided path .
def load_model(model_file_path: str) -> nn.Module:
    embed_dim = 64
    scene_dim = 1024
    encoder_type = "kwmlp"
    model = AudioMLP_Wrapper(
        sample_rate=16000,
        timestamp_embedding_size=embed_dim,
        scene_embedding_size=scene_dim,
        encoder_type=encoder_type,
        encoder_ckpt=model_file_path
    )
    assert isinstance(model, nn.Module)
    assert hasattr(model, "sample_rate")
    assert hasattr(model, "timestamp_embedding_size")
    assert hasattr(model, "scene_embedding_size")
    device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
    model = model.to(device)
    model.eval()
    return model
def load_model ( model_file_path : str ) -> nn . Module : embed_dim = 64 scene_dim = 1024 encoder_type = "kwmlp" model = AudioMLP_Wrapper ( sample_rate = 16000 , timestamp_embedding_size = embed_dim , scene_embedding_size = scene_dim , encoder_type = encoder_type , encoder_ckpt = model_file_path ) assert isinstance ( model , nn . Module ) assert hasattr ( model , "sample_rate" ) assert hasattr ( model , "timestamp_embedding_size" ) assert hasattr ( model , "scene_embedding_size" ) device = torch . device ( "cuda" if torch . cuda . is_available ( ) else "cpu" ) model = model . to ( device ) model . eval ( ) return model
Loads model weights from provided path.
Loads model weights from provided path .
"""Loads model weights from provided path.

    Args:
        model_file_path (str): Provided checkpoint path.

    Returns:
        nn.Module: Model instance.
    """
None
nn.Module
model_file_path
str
Provided checkpoint path.
Provided checkpoint path .