<commit_before><commit_msg>Add layer creation sanity checks<commit_after>from thinc.api import registry
import pytest


@pytest.mark.parametrize(
    "name,kwargs",
    [
        ("CauchySimilarity.v0", {}),
        ("Dropout.v0", {}),
        ("Embed.v0", {}),
        ("ExtractWindow.v0", {}),
        ("FeatureExtractor.v0", {"columns": [1, 2]}),
        ("HashEmbed.v0", {"nO": 1, "nV": 2}),
        ("LayerNorm.v0", {}),
        ("Linear.v0", {}),
        ("BiLSTM.v0", {}),
        ("LSTM.v0", {}),
        ("Maxout.v0", {}),
        ("MaxPool.v0", {}),
        ("MeanPool.v0", {}),
        ("Mish.v0", {}),
        ("MultiSoftmax.v0", {"nOs": (1, 2, 3)}),
        ("ParametricAttention.v0", {}),
        ("ReLu.v0", {}),
        ("Softmax.v0", {}),
        ("SparseLinear.v0", {}),
        ("StaticVectors.v0", {"lang": "en", "nO": 5}),
        ("SumPool.v0", {}),
    ],
)
def test_layers_from_config(name, kwargs):
    cfg = {"@layers": name, **kwargs}
    filled = registry.fill_config({"config": cfg})
    registry.make_from_config(filled)
{'fraction_non_alphanumeric': 0.25047619047619046, 'fraction_numerical': 0.02761904761904762, 'mean_word_length': 2.4916943521594686, 'pattern_counts': {'":': 8, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5985720', 'n_tokens_mistral': 402, 'n_tokens_neox': 392, 'n_words': 59}