def CPUStreamingRNN(cache_dir=None):
    """
    DanSpeech model with lookahead, which works as a real-time streaming model.

    This model runs on most modern CPUs.

    2 conv layers

    5 RNN layers (not bidirectional) with 800 units each

    Lookahead context is 20

    :param str cache_dir: If you wish to use custom directory to stash/cache your models. This is generally not
        recommended, and if left out, the DanSpeech models will be stored in the ``~/.danspeech/models/`` folder.

    :return: Pretrained DeepSpeech (Streaming for CPU) model
    :rtype: ``danspeech.deepspeech.model.DeepSpeech``

    """
    model_path = get_model(model_name="CPUStreamingRNN.pth",
                           origin=MODEL_PACKAGE,
                           file_hash="ba514ec96b511c0797dc643190a80269",
                           cache_dir=cache_dir)
    model = DeepSpeech.load_model(model_path)
    return model
Exemple #2
0
def DSLWiki3gram(cache_dir=None):
    """
    DSL and wikipedia corpus trained 3-gram model.

    :param str cache_dir: If you wish to use custom directory to stash/cache your models. This is generally not
        recommended, and if left out, the DanSpeech models will be stored in the ``~/.danspeech/lms/`` folder.
    :return: path to .klm language model
    :rtype: str
    """
    return get_model(model_name="dsl_wiki_3gram.klm",
                     origin=LANGUAGE_MODEL_ORIGIN,
                     file_hash="f38f55a1e14ad888cee3ea1e643593dc",
                     cache_dir=cache_dir,
                     file_type="language_model")
Exemple #3
0
def DSL5gram(cache_dir=None):
    """
    DSL 5-gram language model. This is the best performing for out test cases along with DSL 3-gram.

    :param str cache_dir: If you wish to use custom directory to stash/cache your models. This is generally not
        recommended, and if left out, the DanSpeech models will be stored in the ``~/.danspeech/lms/`` folder.
    :return: path to .klm language model
    :rtype: str
    """
    return get_model(model_name="dsl_5gram.klm",
                     origin=LANGUAGE_MODEL_ORIGIN,
                     file_hash="f2929d6d154b57b8be0c05347036c7e6",
                     cache_dir=cache_dir,
                     file_type="language_model")
Exemple #4
0
def DSLWiki5gram(cache_dir=None):
    """
    DSL and wikipedia corpus trained 5-gram model.

    :param str cache_dir: If you wish to use custom directory to stash/cache your models. This is generally not
        recommended, and if left out, the DanSpeech models will be stored in the ``~/.danspeech/lms/`` folder.
    :return: path to .klm language model
    :rtype: str
    """
    return get_model(model_name="dsl_wiki_5gram.klm",
                     origin=LANGUAGE_MODEL_ORIGIN,
                     file_hash="070287617eacbbde79df2be34ac9615f",
                     cache_dir=cache_dir,
                     file_type="language_model")
Exemple #5
0
def Wiki5gram(cache_dir=None):
    """
    wikipedia corpus trained 5-gram model.

    :param str cache_dir: If you wish to use custom directory to stash/cache your models. This is generally not
        recommended, and if left out, the DanSpeech models will be stored in the ``~/.danspeech/lms/`` folder.
    :return: path to .klm language model
    :rtype: str
    """
    return get_model(model_name="wiki_5gram.klm",
                     origin=LANGUAGE_MODEL_ORIGIN,
                     file_hash="b329e215b2fde5ffe3e2c94204f6c189",
                     cache_dir=cache_dir,
                     file_type="language_model")
Exemple #6
0
def Folketinget3gram(cache_dir=None):
    """
    3-gram language model trained on all meeting summaries from the Danish Parliament (Folketinget)

    :param str cache_dir: If you wish to use custom directory to stash/cache your models. This is generally not
        recommended, and if left out, the DanSpeech models will be stored in the ``~/.danspeech/lms/`` folder.
    :return: path to .klm language model
    :rtype: str
    """
    return get_model(model_name="da_lm_3gram_folketinget.klm",
                     origin=LANGUAGE_MODEL_ORIGIN,
                     file_hash="011771d8bef6ff531812a768f631b4a2",
                     cache_dir=cache_dir,
                     file_type="language_model")
Exemple #7
0
def DSLWikiLeipzig3gram(cache_dir=None):
    """
    DSL, wikipedia and Leipzig corpus trained 3-gram model.

    :param str cache_dir: If you wish to use custom directory to stash/cache your models. This is generally not
        recommended, and if left out, the DanSpeech models will be stored in the ``~/.danspeech/lms/`` folder.
    :return: path to .klm language model
    :rtype: str
    """
    return get_model(model_name="dsl_wiki_leipzig_3gram.klm",
                     origin=LANGUAGE_MODEL_ORIGIN,
                     file_hash="8409a469be718209afdd18692a2d5609",
                     cache_dir=cache_dir,
                     file_type="language_model")
Exemple #8
0
def Wiki3gram(cache_dir=None):
    """
    wikipedia corpus trained 3-gram model.

    :param str cache_dir: If you wish to use custom directory to stash/cache your models. This is generally not
        recommended, and if left out, the DanSpeech models will be stored in the ``~/.danspeech/lms/`` folder.
    :return: path to .klm language model
    :rtype: str
    """
    return get_model(model_name="wiki_3gram.klm",
                     origin=LANGUAGE_MODEL_ORIGIN,
                     file_hash="12877123bbbbaa72826746cad0af6f7d",
                     cache_dir=cache_dir,
                     file_type="language_model")
Exemple #9
0
def DSL3gramWithNames(cache_dir=None):
    """
    Includes DSL + a bias towards the most common names in Denmark.

    DSL 3-gram language model. This is the best performing for out test cases along with DSL 5-gram.

    :param str cache_dir: If you wish to use custom directory to stash/cache your models. This is generally not
        recommended, and if left out, the DanSpeech models will be stored in the ``~/.danspeech/lms/`` folder.
    :return: path to .klm language model
    :rtype: str
    """
    return get_model(model_name="dsl_names.klm",
                     origin=LANGUAGE_MODEL_ORIGIN,
                     file_hash="1b47e2db841c6be5c62004ef51a40c68",
                     cache_dir=cache_dir,
                     file_type="language_model")
Exemple #10
0
def Folketinget(cache_dir=None):
    """
    The deepest and best performing DanSpeech model finetuned to data from Folketinget.

    3 Conv layers

    9 RNN Layers with 1200 hidden units

    :param str cache_dir: If you wish to use custom directory to stash/cache your models. This is generally not
        recommended, and if left out, the DanSpeech models will be stored in the ``~/.danspeech/models/`` folder.

    :return: Pretrained DeepSpeech (Folketinget tuned) model.
    :rtype: ``danspeech.deepspeech.model.DeepSpeech``
    """
    model_path = get_model(model_name="Folketinget.pth",
                           origin=MODEL_PACKAGE,
                           file_hash="9523d5744ad4ff5ffc8519393350cc91",
                           cache_dir=cache_dir)
    model = DeepSpeech.load_model(model_path)
    return model
Exemple #11
0
def Baseline(cache_dir=None):
    """
    Baseline DanSpeech model.

    2 Conv layers

    5 RNN Layers with 800 hidden units

    :param str cache_dir: If you wish to use custom directory to stash/cache your models. This is generally not
        recommended, and if left out, the DanSpeech models will be stored in the ``~/.danspeech/models/`` folder.

    :return: Pretrained DeepSpeech (Baseline) model.
    :rtype: ``danspeech.deepspeech.model.DeepSpeech``
    """
    model_path = get_model(model_name="Baseline.pth",
                           origin=MODEL_PACKAGE,
                           file_hash="e2c0c16d518fc57cd61c86cbb0170660",
                           cache_dir=cache_dir)
    model = DeepSpeech.load_model(model_path)
    return model
Exemple #12
0
def DanSpeechPrimary(cache_dir=None):
    """
    Deepest and best performing DanSpeech model.

    3 Conv layers

    9 RNN Layers with 1200 hidden units

    :param str cache_dir: If you wish to use custom directory to stash/cache your models. This is generally not
        recommended, and if left out, the DanSpeech models will be stored in the ``~/.danspeech/models/`` folder.

    :return: Pretrained DeepSpeech (Best Performing) model.
    :rtype: ``danspeech.deepspeech.model.DeepSpeech``
    """
    model_path = get_model(model_name="DanSpeechPrimary.pth",
                           origin=MODEL_PACKAGE,
                           file_hash="5bd08282d442e990c37481d5c61cf93c",
                           cache_dir=cache_dir)
    model = DeepSpeech.load_model(model_path)
    return model
Exemple #13
0
def EnglishLibrispeech(cache_dir=None):
    """
    English trained model on the Librispeech corpus.

    2 Conv layers

    5 RNN Layers with 800 hidden units


    :param str cache_dir: If you wish to use custom directory to stash/cache your models. This is generally not
        recommended, and if left out, the DanSpeech models will be stored in the ``~/.danspeech/models/`` folder.

    :return: Pretrained DeepSpeech (English speech recognition) model.
    :rtype: ``danspeech.deepspeech.model.DeepSpeech``

    """
    model_path = get_model(model_name="Librispeech.pth",
                           origin=MODEL_PACKAGE,
                           file_hash="56630094905e7308f42ae0f82421440b",
                           cache_dir=cache_dir)
    model = DeepSpeech.load_model(model_path)
    return model
def GPUStreamingRNN(cache_dir=None):
    """
    DanSpeech model with lookahead, which works as a real-time streaming model.

    This model will not be able to follow a stream of data on regular CPUS. Hence, use a GPU.

    2 conv layers

    5 RNN layers (not bidirectional) with 2000 units each

    Lookahead context is 20

    :param str cache_dir: If you wish to use custom directory to stash/cache your models. This is generally not
        recommended, and if left out, the DanSpeech models will be stored in the ``~/.danspeech/models/`` folder.

    :return: Pretrained DeepSpeech (Streaming for GPU) model
    :rtype: ``danspeech.deepspeech.model.DeepSpeech``
    """
    model_path = get_model(model_name="GPUStreamingRNN.pth", origin=MODEL_PACKAGE,
                           file_hash="8194f47f5c63c14c3587d42aa37d622d", cache_dir=cache_dir)
    model = DeepSpeech.load_model(model_path)
    return model
Exemple #15
0
def TransferLearned(cache_dir=None):
    """
    The Librispeech English model adapted to Danish while keeping the conv layers and the lowest/first RNN layer frozen

    This model performs better than the DanSpeechPrimary model on noisy data.

    2 Conv layers

    5 RNN Layers with 800 hidden units

    param str cache_dir: If you wish to use custom directory to stash/cache your models. This is generally not
    recommended, and if left out, the DanSpeech models will be stored in the ``~/.danspeech/models/`` folder.

    :return: Pretrained DeepSpeech (Transfer learned from English) model
    :rtype: ``danspeech.deepspeech.model.DeepSpeech``
    """
    model_path = get_model(model_name="TransferLearned.pth",
                           origin=MODEL_PACKAGE,
                           file_hash="d19b9d7dc976bffbc9225e0f80ecacbf",
                           cache_dir=cache_dir)
    model = DeepSpeech.load_model(model_path)
    return model
Exemple #16
0
def TestModel(cache_dir=None):
    """
    Test model that runs very fast even on CPUs

    Performance is very bad!

    2 Conv layers

    5 RNN Layers with 400 hidden units


    :param str cache_dir: If you wish to use custom directory to stash/cache your models. This is generally not
        recommended, and if left out, the DanSpeech models will be stored in the ``~/.danspeech/models/`` folder.

    :return: Pretrained DeepSpeech (Testing purposes) model
    :rtype: ``danspeech.deepspeech.model.DeepSpeech``
    """

    model_path = get_model(model_name="TestModel.pth",
                           origin=MODEL_PACKAGE,
                           file_hash="c21438a33f847a9c8d4e08779e98bf31",
                           cache_dir=cache_dir)
    model = DeepSpeech.load_model(model_path)
    return model