repo_id stringclasses 400
values | commit_sha stringclasses 400
values | commit_index int32 0 951 | in_repo_split stringclasses 1
value | cross_repo_split stringclasses 1
value | test_file stringlengths 7 121 | test_function stringlengths 1 108 | assertion_type stringclasses 32
values | difficulty stringclasses 8
values | context_lines int32 3 600 | prefix large_stringlengths 44 113k | target large_stringlengths 1 498 | anchor_sha stringclasses 400
values | anchor_index int32 0 951 | qna_source stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
explosion/spacy-llm | fad52532857b425eb2a55aecc09330e1e1d7d727 | 72 | train | train | spacy_llm/tests/test_cache.py | test_caching | assert | numeric_literal | 57 | import copy
import os
import re
import time
from pathlib import Path
from typing import Dict, Iterable
import pytest
import spacy
import srsly # type: ignore[import]
from spacy.language import Language
from spacy.tokens import Doc, DocBin
from ..cache import BatchCache
from ..registry import registry
_DEFAULT_CFG =... | 0 | fad52532857b425eb2a55aecc09330e1e1d7d727 | 72 | v2_extractor_at_anchor |
explosion/spacy-llm | fad52532857b425eb2a55aecc09330e1e1d7d727 | 72 | train | train | spacy_llm/tests/test_cache.py | test_caching | assert | variable | 60 | import copy
import os
import re
import time
from pathlib import Path
from typing import Dict, Iterable
import pytest
import spacy
import srsly # type: ignore[import]
from spacy.language import Language
from spacy.tokens import Doc, DocBin
from ..cache import BatchCache
from ..registry import registry
_DEFAULT_CFG =... | n | fad52532857b425eb2a55aecc09330e1e1d7d727 | 72 | v2_extractor_at_anchor |
explosion/spacy-llm | fad52532857b425eb2a55aecc09330e1e1d7d727 | 72 | train | train | spacy_llm/tests/test_cache.py | test_caching_llm_io | assert | numeric_literal | 51 | import copy
import os
import re
import time
from pathlib import Path
from typing import Dict, Iterable
import pytest
import spacy
import srsly # type: ignore[import]
from spacy.language import Language
from spacy.tokens import Doc, DocBin
from ..cache import BatchCache
from ..registry import registry
_DEFAULT_CFG =... | 1 | fad52532857b425eb2a55aecc09330e1e1d7d727 | 72 | v2_extractor_at_anchor |
explosion/spacy-llm | fad52532857b425eb2a55aecc09330e1e1d7d727 | 72 | train | train | spacy_llm/tests/test_cache.py | test_caching_llm_io | assert | numeric_literal | 55 | import copy
import os
import re
import time
from pathlib import Path
from typing import Dict, Iterable
import pytest
import spacy
import srsly # type: ignore[import]
from spacy.language import Language
from spacy.tokens import Doc, DocBin
from ..cache import BatchCache
from ..registry import registry
_DEFAULT_CFG =... | 3 | fad52532857b425eb2a55aecc09330e1e1d7d727 | 72 | v2_extractor_at_anchor |
explosion/spacy-llm | fad52532857b425eb2a55aecc09330e1e1d7d727 | 72 | train | train | spacy_llm/tests/test_cache.py | test_caching_interrupted | assert | complex_expr | 62 | import copy
import os
import re
import time
from pathlib import Path
from typing import Dict, Iterable
import pytest
import spacy
import srsly # type: ignore[import]
from spacy.language import Language
from spacy.tokens import Doc, DocBin
from ..cache import BatchCache
from ..registry import registry
_DEFAULT_CFG =... | n / 2 | fad52532857b425eb2a55aecc09330e1e1d7d727 | 72 | v2_extractor_at_anchor |
explosion/spacy-llm | fad52532857b425eb2a55aecc09330e1e1d7d727 | 72 | train | train | spacy_llm/tests/test_cache.py | test_prompt_template_handling | assert | func_call | 48 | import copy
import os
import re
import time
from pathlib import Path
from typing import Dict, Iterable
import pytest
import spacy
import srsly # type: ignore[import]
from spacy.language import Language
from spacy.tokens import Doc, DocBin
from ..cache import BatchCache
from ..registry import registry
_DEFAULT_CFG =... | hash(llm._task.prompt_template) | fad52532857b425eb2a55aecc09330e1e1d7d727 | 72 | v2_extractor_at_anchor |
explosion/spacy-llm | fad52532857b425eb2a55aecc09330e1e1d7d727 | 72 | train | train | spacy_llm/tests/test_cache.py | test_prompt_template_handling | pytest.raises | complex_expr | 51 | import copy
import os
import re
import time
from pathlib import Path
from typing import Dict, Iterable
import pytest
import spacy
import srsly # type: ignore[import]
from spacy.language import Language
from spacy.tokens import Doc, DocBin
from ..cache import BatchCache
from ..registry import registry
_DEFAULT_CFG =... | ValueError, match="Prompt template in cache directory") | fad52532857b425eb2a55aecc09330e1e1d7d727 | 72 | v2_extractor_at_anchor |
explosion/spacy-llm | fad52532857b425eb2a55aecc09330e1e1d7d727 | 72 | train | train | spacy_llm/tests/test_cache.py | test_path_file_invalid | pytest.raises | complex_expr | 38 | import copy
import os
import re
import time
from pathlib import Path
from typing import Dict, Iterable
import pytest
import spacy
import srsly # type: ignore[import]
from spacy.language import Language
from spacy.tokens import Doc, DocBin
from ..cache import BatchCache
from ..registry import registry
_DEFAULT_CFG =... | ValueError, match="Cache directory exists and is not a directory.") | fad52532857b425eb2a55aecc09330e1e1d7d727 | 72 | v2_extractor_at_anchor |
explosion/spacy-llm | fad52532857b425eb2a55aecc09330e1e1d7d727 | 72 | train | train | spacy_llm/tests/test_combinations.py | test_combinations | assert | string_literal | 49 | from typing import Any, Dict
import pytest
import spacy
from thinc.api import NumpyOps, get_current_ops
from spacy_llm.compat import has_langchain
from spacy_llm.pipeline import LLMWrapper
@pytest.mark.external
@pytest.mark.skipif(has_langchain is False, reason="LangChain is not installed")
@pytest.mark.parametrize(... | "llm" | fad52532857b425eb2a55aecc09330e1e1d7d727 | 72 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | examples/old/wrap_pytorch_rnn.py | check_Y_shape | assert | collection | 15 | import torch
import numpy
from thinc.neural.optimizers import SGD
from torch import autograd
from torch import nn
import torch.optim
from thinc.extra.wrappers import PyTorchWrapperRNN
def check_Y_shape(
model, X, Y, sequence_length, batch_size, hidden_size, num_directions
):
outputs, get_dX = model.begin_updat... | (sequence_length, batch_size, hidden_size * num_directions) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/backends/test_mem.py | test_param_server_init | assert | collection | 11 | from thinc.backends._param_server import ParamServer
import numpy
def test_param_server_init():
array = numpy.zeros((5,), dtype="f")
params = {("a", 1): array, ("b", 2): array}
grads = {("a", 1): array, ("c", 3): array}
ps = ParamServer(params, grads)
assert ps.param_keys == (("a", 1), ("b", 2))
... | (("a", 1),) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/backends/test_mem.py | test_param_server_init | assert | collection | 10 | from thinc.backends._param_server import ParamServer
import numpy
def test_param_server_init():
array = numpy.zeros((5,), dtype="f")
params = {("a", 1): array, ("b", 2): array}
grads = {("a", 1): array, ("c", 3): array}
ps = ParamServer(params, grads)
assert ps.param_keys == | (("a", 1), ("b", 2)) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/backends/test_ops.py | test_hash_gives_distinct_keys | assert | numeric_literal | 27 | import pytest
import numpy
from hypothesis import given, settings
from numpy.testing import assert_allclose
from thinc.api import NumpyOps, CupyOps, Ops, get_ops
from .. import strategies
MAX_EXAMPLES = 10
VANILLA_OPS = Ops(numpy)
NUMPY_OPS = NumpyOps()
CPU_OPS = [NUMPY_OPS, VANILLA_OPS]
XP_OPS = [NUMPY_OPS]
ALL_OP... | 0 | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/backends/test_ops.py | test_flatten_unflatten_roundtrip | assert | numeric_literal | 24 | import pytest
import numpy
from hypothesis import given, settings
from numpy.testing import assert_allclose
from thinc.api import NumpyOps, CupyOps, Ops, get_ops
from .. import strategies
MAX_EXAMPLES = 10
VANILLA_OPS = Ops(numpy)
NUMPY_OPS = NumpyOps()
CPU_OPS = [NUMPY_OPS, VANILLA_OPS]
XP_OPS = [NUMPY_OPS]
ALL_OP... | 1 | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/backends/test_ops.py | test_gemm_computes_correctly | assert_* | variable | 27 | import pytest
import numpy
from hypothesis import given, settings
from numpy.testing import assert_allclose
from thinc.api import NumpyOps, CupyOps, Ops, get_ops
from .. import strategies
MAX_EXAMPLES = 10
VANILLA_OPS = Ops(numpy)
NUMPY_OPS = NumpyOps()
CPU_OPS = [NUMPY_OPS, VANILLA_OPS]
XP_OPS = [NUMPY_OPS]
ALL_OP... | Y) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/backends/test_ops.py | test_clip_low_computes_correctly_for_zero | assert_* | variable | 25 | import pytest
import numpy
from hypothesis import given, settings
from numpy.testing import assert_allclose
from thinc.api import NumpyOps, CupyOps, Ops, get_ops
from .. import strategies
MAX_EXAMPLES = 10
VANILLA_OPS = Ops(numpy)
NUMPY_OPS = NumpyOps()
CPU_OPS = [NUMPY_OPS, VANILLA_OPS]
XP_OPS = [NUMPY_OPS]
ALL_OP... | y) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/backends/test_ops.py | test_get_dropout_not_empty | assert | variable | 26 | import pytest
import numpy
from hypothesis import given, settings
from numpy.testing import assert_allclose
from thinc.api import NumpyOps, CupyOps, Ops, get_ops
from .. import strategies
MAX_EXAMPLES = 10
VANILLA_OPS = Ops(numpy)
NUMPY_OPS = NumpyOps()
CPU_OPS = [NUMPY_OPS, VANILLA_OPS]
XP_OPS = [NUMPY_OPS]
ALL_OP... | shape | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/backends/test_ops.py | test_get_ops | assert | variable | 31 | import pytest
import numpy
from hypothesis import given, settings
from numpy.testing import assert_allclose
from thinc.api import NumpyOps, CupyOps, Ops, get_ops
from .. import strategies
MAX_EXAMPLES = 10
VANILLA_OPS = Ops(numpy)
NUMPY_OPS = NumpyOps()
CPU_OPS = [NUMPY_OPS, VANILLA_OPS]
XP_OPS = [NUMPY_OPS]
ALL_OP... | numpy | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/backends/test_ops.py | test_hash_gives_distinct_keys | assert | collection | 23 | import pytest
import numpy
from hypothesis import given, settings
from numpy.testing import assert_allclose
from thinc.api import NumpyOps, CupyOps, Ops, get_ops
from .. import strategies
MAX_EXAMPLES = 10
VANILLA_OPS = Ops(numpy)
NUMPY_OPS = NumpyOps()
CPU_OPS = [NUMPY_OPS, VANILLA_OPS]
XP_OPS = [NUMPY_OPS]
ALL_OP... | (5, 4) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/backends/test_ops.py | test_max_pool_sm | assert_* | variable | 30 | import pytest
import numpy
from hypothesis import given, settings
from numpy.testing import assert_allclose
from thinc.api import NumpyOps, CupyOps, Ops, get_ops
from .. import strategies
MAX_EXAMPLES = 10
VANILLA_OPS = Ops(numpy)
NUMPY_OPS = NumpyOps()
CPU_OPS = [NUMPY_OPS, VANILLA_OPS]
XP_OPS = [NUMPY_OPS]
ALL_OP... | truth) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/backends/test_ops.py | test_flatten_unflatten_roundtrip | assert_* | variable | 26 | import pytest
import numpy
from hypothesis import given, settings
from numpy.testing import assert_allclose
from thinc.api import NumpyOps, CupyOps, Ops, get_ops
from .. import strategies
MAX_EXAMPLES = 10
VANILLA_OPS = Ops(numpy)
NUMPY_OPS = NumpyOps()
CPU_OPS = [NUMPY_OPS, VANILLA_OPS]
XP_OPS = [NUMPY_OPS]
ALL_OP... | unflat) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/backends/test_ops.py | test_sum_pool | assert | func_call | 25 | import pytest
import numpy
from hypothesis import given, settings
from numpy.testing import assert_allclose
from thinc.api import NumpyOps, CupyOps, Ops, get_ops
from .. import strategies
MAX_EXAMPLES = 10
VANILLA_OPS = Ops(numpy)
NUMPY_OPS = NumpyOps()
CPU_OPS = [NUMPY_OPS, VANILLA_OPS]
XP_OPS = [NUMPY_OPS]
ALL_OP... | m.sum() | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/backends/test_ops.py | test_softplus | assert | complex_expr | 25 | import pytest
import numpy
from hypothesis import given, settings
from numpy.testing import assert_allclose
from thinc.api import NumpyOps, CupyOps, Ops, get_ops
from .. import strategies
MAX_EXAMPLES = 10
VANILLA_OPS = Ops(numpy)
NUMPY_OPS = NumpyOps()
CPU_OPS = [NUMPY_OPS, VANILLA_OPS]
XP_OPS = [NUMPY_OPS]
ALL_OP... | X.shape | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/backends/test_ops.py | test_get_ops | assert | variable | 25 | import pytest
import numpy
from hypothesis import given, settings
from numpy.testing import assert_allclose
from thinc.api import NumpyOps, CupyOps, Ops, get_ops
from .. import strategies
MAX_EXAMPLES = 10
VANILLA_OPS = Ops(numpy)
NUMPY_OPS = NumpyOps()
CPU_OPS = [NUMPY_OPS, VANILLA_OPS]
XP_OPS = [NUMPY_OPS]
ALL_OP... | CupyOps | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/backends/test_ops.py | test_hash_gives_distinct_keys | assert | string_literal | 24 | import pytest
import numpy
from hypothesis import given, settings
from numpy.testing import assert_allclose
from thinc.api import NumpyOps, CupyOps, Ops, get_ops
from .. import strategies
MAX_EXAMPLES = 10
VANILLA_OPS = Ops(numpy)
NUMPY_OPS = NumpyOps()
CPU_OPS = [NUMPY_OPS, VANILLA_OPS]
XP_OPS = [NUMPY_OPS]
ALL_OP... | "uint32" | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/backends/test_ops.py | test_flatten_unflatten_roundtrip | assert_* | variable | 30 | import pytest
import numpy
from hypothesis import given, settings
from numpy.testing import assert_allclose
from thinc.api import NumpyOps, CupyOps, Ops, get_ops
from .. import strategies
MAX_EXAMPLES = 10
VANILLA_OPS = Ops(numpy)
NUMPY_OPS = NumpyOps()
CPU_OPS = [NUMPY_OPS, VANILLA_OPS]
XP_OPS = [NUMPY_OPS]
ALL_OP... | unflat2) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_basic_tagger.py | test_small_end_to_end | assert | complex_expr | 65 | import pytest
import random
from thinc.api import Model, ReLu, Softmax, HashEmbed, ExtractWindow
from thinc.api import chain, with_array, Adam, strings2arrays
import ml_datasets
def ancora():
return ml_datasets.ud_ancora_pos_tags()
def create_embed_relu_relu_softmax(depth, width, vector_length):
with Model.de... | losses[0] | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_basic_tagger.py | test_small_end_to_end | assert | complex_expr | 66 | import pytest
import random
from thinc.api import Model, ReLu, Softmax, HashEmbed, ExtractWindow
from thinc.api import chain, with_array, Adam, strings2arrays
import ml_datasets
def ancora():
return ml_datasets.ud_ancora_pos_tags()
def create_embed_relu_relu_softmax(depth, width, vector_length):
with Model.de... | scores[0] | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_combinators.py | test_chain_two | assert | numeric_literal | 31 | import pytest
import numpy
from thinc.api import clone, concatenate, noop, add
from thinc.api import Linear, Dropout, Model
from thinc.layers import chain
def nB(request):
return request.param
def nI(request):
return request.param
def nH(request):
return request.param
def nO(request):
return request... | 2 | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_combinators.py | test_chain_three | assert | numeric_literal | 31 | import pytest
import numpy
from thinc.api import clone, concatenate, noop, add
from thinc.api import Linear, Dropout, Model
from thinc.layers import chain
def nB(request):
return request.param
def nI(request):
return request.param
def nH(request):
return request.param
def nO(request):
return request... | 3 | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_combinators.py | test_clone_gives_distinct_ids | assert | numeric_literal | 31 | import pytest
import numpy
from thinc.api import clone, concatenate, noop, add
from thinc.api import Linear, Dropout, Model
from thinc.layers import chain
def nB(request):
return request.param
def nI(request):
return request.param
def nH(request):
return request.param
def nO(request):
return request... | 5 | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_combinators.py | test_clone_gives_distinct_ids | assert | numeric_literal | 36 | import pytest
import numpy
from thinc.api import clone, concatenate, noop, add
from thinc.api import Linear, Dropout, Model
from thinc.layers import chain
def nB(request):
return request.param
def nI(request):
return request.param
def nH(request):
return request.param
def nO(request):
return request... | 6 | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_combinators.py | test_clone_noop | assert | numeric_literal | 31 | import pytest
import numpy
from thinc.api import clone, concatenate, noop, add
from thinc.api import Linear, Dropout, Model
from thinc.layers import chain
def nB(request):
return request.param
def nI(request):
return request.param
def nH(request):
return request.param
def nO(request):
return request... | 0 | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_combinators.py | test_clone_noop | assert | string_literal | 32 | import pytest
import numpy
from thinc.api import clone, concatenate, noop, add
from thinc.api import Linear, Dropout, Model
from thinc.layers import chain
def nB(request):
return request.param
def nI(request):
return request.param
def nH(request):
return request.param
def nO(request):
return request... | "noop" | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_combinators.py | test_clone_gives_distinct_ids | assert | variable | 34 | import pytest
import numpy
from thinc.api import clone, concatenate, noop, add
from thinc.api import Linear, Dropout, Model
from thinc.layers import chain
def nB(request):
return request.param
def nI(request):
return request.param
def nH(request):
return request.param
def nO(request):
return request... | seen_ids | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_combinators.py | test_add | assert | complex_expr | 37 | import pytest
import numpy
from thinc.api import clone, concatenate, noop, add
from thinc.api import Linear, Dropout, Model
from thinc.layers import chain
def nB(request):
return request.param
def nI(request):
return request.param
def nH(request):
return request.param
def nO(request):
return request... | data.shape | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_feature_extractor.py | test_pickle | assert | complex_expr | 9 | from srsly import cloudpickle as pickle
from thinc.api import FeatureExtractor
def test_pickle():
model = FeatureExtractor([100, 200])
bytes_data = pickle.dumps(model)
loaded = pickle.loads(bytes_data)
assert loaded._attrs == | model._attrs | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_feed_forward.py | test_infer_output_shape | assert | numeric_literal | 58 | import pytest
import numpy
from functools import partial
from numpy.testing import assert_allclose
from thinc.api import chain, Linear, ReLu
def nB(request):
return request.param
def nI(request):
return request.param
def nH(request):
return request.param
def nO(request):
return request.param
def mo... | 5 | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_feed_forward.py | test_infer_output_shape | assert | numeric_literal | 59 | import pytest
import numpy
from functools import partial
from numpy.testing import assert_allclose
from thinc.api import chain, Linear, ReLu
def nB(request):
return request.param
def nI(request):
return request.param
def nH(request):
return request.param
def nO(request):
return request.param
def mo... | 2 | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_feed_forward.py | test_infer_output_shape | assert | none_literal | 55 | import pytest
import numpy
from functools import partial
from numpy.testing import assert_allclose
from thinc.api import chain, Linear, ReLu
def nB(request):
return request.param
def nI(request):
return request.param
def nH(request):
return request.param
def nO(request):
return request.param
def mo... | None | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_feed_forward.py | test_models_have_shape | assert | collection | 53 | import pytest
import numpy
from functools import partial
from numpy.testing import assert_allclose
from thinc.api import chain, Linear, ReLu
def nB(request):
return request.param
def nI(request):
return request.param
def nH(request):
return request.param
def nO(request):
return request.param
def mo... | (nH,) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_feed_forward.py | test_models_have_shape | assert | collection | 55 | import pytest
import numpy
from functools import partial
from numpy.testing import assert_allclose
from thinc.api import chain, Linear, ReLu
def nB(request):
return request.param
def nI(request):
return request.param
def nH(request):
return request.param
def nO(request):
return request.param
def mo... | (nO,) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_feed_forward.py | test_gradient | assert_* | variable | 66 | import pytest
import numpy
from functools import partial
from numpy.testing import assert_allclose
from thinc.api import chain, Linear, ReLu
def nB(request):
return request.param
def nI(request):
return request.param
def nH(request):
return request.param
def nO(request):
return request.param
def mo... | ngrad) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_feed_forward.py | test_models_have_shape | assert | collection | 52 | import pytest
import numpy
from functools import partial
from numpy.testing import assert_allclose
from thinc.api import chain, Linear, ReLu
def nB(request):
return request.param
def nI(request):
return request.param
def nH(request):
return request.param
def nO(request):
return request.param
def mo... | (nH, nI) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_feed_forward.py | test_models_have_shape | assert | collection | 54 | import pytest
import numpy
from functools import partial
from numpy.testing import assert_allclose
from thinc.api import chain, Linear, ReLu
def nB(request):
return request.param
def nI(request):
return request.param
def nH(request):
return request.param
def nO(request):
return request.param
def mo... | (nO, nH) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_feed_forward.py | test_predict_and_begin_update_match | assert_* | variable | 61 | import pytest
import numpy
from functools import partial
from numpy.testing import assert_allclose
from thinc.api import chain, Linear, ReLu
def nB(request):
return request.param
def nI(request):
return request.param
def nH(request):
return request.param
def nO(request):
return request.param
def mo... | expected) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_feed_forward.py | test_predict_and_begin_update_match | assert_* | variable | 55 | import pytest
import numpy
from functools import partial
from numpy.testing import assert_allclose
from thinc.api import chain, Linear, ReLu
def nB(request):
return request.param
def nI(request):
return request.param
def nH(request):
return request.param
def nO(request):
return request.param
def mo... | via_update) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_feed_forward.py | test_model_shape | assert | func_call | 52 | import pytest
import numpy
from functools import partial
from numpy.testing import assert_allclose
from thinc.api import chain, Linear, ReLu
def nB(request):
return request.param
def nI(request):
return request.param
def nH(request):
return request.param
def nO(request):
return request.param
def mo... | model1.get_dim("nI") | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_feed_forward.py | test_model_shape | assert | func_call | 53 | import pytest
import numpy
from functools import partial
from numpy.testing import assert_allclose
from thinc.api import chain, Linear, ReLu
def nB(request):
return request.param
def nI(request):
return request.param
def nH(request):
return request.param
def nO(request):
return request.param
def mo... | model2.get_dim("nO") | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_hash_embed.py | test_init | assert | numeric_literal | 8 | import numpy
from thinc.api import HashEmbed
def test_init():
model = HashEmbed(64, 1000)
assert model.get_dim("nV") == 1000
assert model.get_dim("nO") == | 64 | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_hash_embed.py | test_init | assert | numeric_literal | 7 | import numpy
from thinc.api import HashEmbed
def test_init():
model = HashEmbed(64, 1000)
assert model.get_dim("nV") == | 1000 | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_hash_embed.py | test_init | assert | collection | 9 | import numpy
from thinc.api import HashEmbed
def test_init():
model = HashEmbed(64, 1000)
assert model.get_dim("nV") == 1000
assert model.get_dim("nO") == 64
assert model.get_param("E").shape == | (1000, 64) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_hash_embed.py | test_seed_changes_bucket | assert | func_call | 11 | import numpy
from thinc.api import HashEmbed
def test_seed_changes_bucket():
model1 = HashEmbed(64, 1000, seed=2)
model2 = HashEmbed(64, 1000, seed=1)
arr = numpy.ones((1,), dtype="uint64")
vector1 = model1.predict(arr)
vector2 = model2.predict(arr)
assert vector1.sum() != | vector2.sum() | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_layers_api.py | test_dropout | assert_* | variable | 34 | from thinc.api import registry, with_padded, Dropout
from thinc.types import Ragged, Padded
from thinc.util import has_torch
import numpy
import pytest
def assert_data_match(Y, out_data):
assert type(Y) == type(out_data)
if isinstance(out_data, numpy.ndarray):
assert isinstance(Y, numpy.ndarray)
... | data) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_layers_api.py | assert_data_match | assert | complex_expr | 12 | from thinc.api import registry, with_padded, Dropout
from thinc.types import Ragged, Padded
from thinc.util import has_torch
import numpy
import pytest
def assert_data_match(Y, out_data):
assert type(Y) == type(out_data)
if isinstance(out_data, numpy.ndarray):
assert isinstance(Y, numpy.ndarray)
... | Y.ndim | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_layers_api.py | test_layers_from_config | assert_* | variable | 40 | from thinc.api import registry, with_padded, Dropout
from thinc.types import Ragged, Padded
from thinc.util import has_torch
import numpy
import pytest
def assert_data_match(Y, out_data):
assert type(Y) == type(out_data)
if isinstance(out_data, numpy.ndarray):
assert isinstance(Y, numpy.ndarray)
... | in_data) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_layers_api.py | test_layers_from_config | assert_* | variable | 38 | from thinc.api import registry, with_padded, Dropout
from thinc.types import Ragged, Padded
from thinc.util import has_torch
import numpy
import pytest
def assert_data_match(Y, out_data):
assert type(Y) == type(out_data)
if isinstance(out_data, numpy.ndarray):
assert isinstance(Y, numpy.ndarray)
... | out_data) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_layers_api.py | assert_data_match | assert | complex_expr | 15 | from thinc.api import registry, with_padded, Dropout
from thinc.types import Ragged, Padded
from thinc.util import has_torch
import numpy
import pytest
def assert_data_match(Y, out_data):
assert type(Y) == type(out_data)
if isinstance(out_data, numpy.ndarray):
assert isinstance(Y, numpy.ndarray)
... | Y.data.ndim | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_layers_api.py | assert_data_match | assert | func_call | 9 | from thinc.api import registry, with_padded, Dropout
from thinc.types import Ragged, Padded
from thinc.util import has_torch
import numpy
import pytest
def assert_data_match(Y, out_data):
assert type(Y) == | type(out_data) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_layers_api.py | assert_data_match | assert | complex_expr | 16 | from thinc.api import registry, with_padded, Dropout
from thinc.types import Ragged, Padded
from thinc.util import has_torch
import numpy
import pytest
def assert_data_match(Y, out_data):
assert type(Y) == type(out_data)
if isinstance(out_data, numpy.ndarray):
assert isinstance(Y, numpy.ndarray)
... | Y.lengths.ndim | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_linear.py | test_init | assert | numeric_literal | 21 | import pytest
from mock import MagicMock
from hypothesis import given, settings
import numpy
from numpy.testing import assert_allclose
from thinc.api import Linear, chain, Dropout, SGD
from ..strategies import arrays_OI_O_BI
from ..util import get_model, get_shape
def model():
model = Linear()
return model
d... | 2 | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_linear.py | test_update | assert | numeric_literal | 48 | import pytest
from mock import MagicMock
from hypothesis import given, settings
import numpy
from numpy.testing import assert_allclose
from thinc.api import Linear, chain, Dropout, SGD
from ..strategies import arrays_OI_O_BI
from ..util import get_model, get_shape
def model():
model = Linear()
return model
d... | 1.0 | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_linear.py | test_update | assert | numeric_literal | 49 | import pytest
from mock import MagicMock
from hypothesis import given, settings
import numpy
from numpy.testing import assert_allclose
from thinc.api import Linear, chain, Dropout, SGD
from ..strategies import arrays_OI_O_BI
from ..util import get_model, get_shape
def model():
model = Linear()
return model
d... | 0.0 | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_linear.py | test_linear_dimensions_on_data | assert | none_literal | 22 | import pytest
from mock import MagicMock
from hypothesis import given, settings
import numpy
from numpy.testing import assert_allclose
from thinc.api import Linear, chain, Dropout, SGD
from ..strategies import arrays_OI_O_BI
from ..util import get_model, get_shape
def model():
model = Linear()
return model
d... | None | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_linear.py | test_linear_default_name | assert | string_literal | 17 | import pytest
from mock import MagicMock
from hypothesis import given, settings
import numpy
from numpy.testing import assert_allclose
from thinc.api import Linear, chain, Dropout, SGD
from ..strategies import arrays_OI_O_BI
from ..util import get_model, get_shape
def model():
model = Linear()
return model
d... | "linear" | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_linear.py | test_predict_weights | assert_* | variable | 38 | import pytest
from mock import MagicMock
from hypothesis import given, settings
import numpy
from numpy.testing import assert_allclose
from thinc.api import Linear, chain, Dropout, SGD
from ..strategies import arrays_OI_O_BI
from ..util import get_model, get_shape
def model():
model = Linear()
return model
d... | expected) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_linear.py | sgd | assert | complex_expr | 18 | import pytest
from mock import MagicMock
from hypothesis import given, settings
import numpy
from numpy.testing import assert_allclose
from thinc.api import Linear, chain, Dropout, SGD
from ..strategies import arrays_OI_O_BI
from ..util import get_model, get_shape
def model():
model = Linear()
return model
... | gradient.shape | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_linear.py | test_predict_bias | assert_* | variable | 29 | import pytest
from mock import MagicMock
from hypothesis import given, settings
import numpy
from numpy.testing import assert_allclose
from thinc.api import Linear, chain, Dropout, SGD
from ..strategies import arrays_OI_O_BI
from ..util import get_model, get_shape
def model():
model = Linear()
return model
d... | target_scores) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_linear.py | test_predict_small | assert_* | variable | 35 | import pytest
from mock import MagicMock
from hypothesis import given, settings
import numpy
from numpy.testing import assert_allclose
from thinc.api import Linear, chain, Dropout, SGD
from ..strategies import arrays_OI_O_BI
from ..util import get_model, get_shape
def model():
model = Linear()
return model
@... | expected_output) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_linear.py | test_predict_bias | assert_* | complex_expr | 24 | import pytest
from mock import MagicMock
from hypothesis import given, settings
import numpy
from numpy.testing import assert_allclose
from thinc.api import Linear, chain, Dropout, SGD
from ..strategies import arrays_OI_O_BI
from ..util import get_model, get_shape
def model():
model = Linear()
return model
d... | target_scores[0]) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_linear.py | test_begin_update_matches_predict | assert_* | variable | 23 | import pytest
from mock import MagicMock
from hypothesis import given, settings
import numpy
from numpy.testing import assert_allclose
from thinc.api import Linear, chain, Dropout, SGD
from ..strategies import arrays_OI_O_BI
from ..util import get_model, get_shape
def model():
model = Linear()
return model
@... | fwd_via_predict_batch) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_linear.py | test_finish_update_calls_optimizer_with_weights | assert | collection | 33 | import pytest
from mock import MagicMock
from hypothesis import given, settings
import numpy
from numpy.testing import assert_allclose
from thinc.api import Linear, chain, Dropout, SGD
from ..strategies import arrays_OI_O_BI
from ..util import get_model, get_shape
def model():
model = Linear()
return model
@... | {(model.id, "W"), (model.id, "b")} | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_lstm.py | test_list2padded | assert | numeric_literal | 21 | import numpy
import timeit
from thinc.api import minibatch, NumpyOps, LSTM, PyTorchLSTM, with_padded
from thinc.util import has_torch
import pytest
def nI(request):
return request.param
def nO(request):
return request.param
def test_list2padded():
ops = NumpyOps()
seqs = [numpy.zeros((5, 4)), numpy.z... | 3 | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_lstm.py | test_list2padded | assert | numeric_literal | 23 | import numpy
import timeit
from thinc.api import minibatch, NumpyOps, LSTM, PyTorchLSTM, with_padded
from thinc.util import has_torch
import pytest
def nI(request):
return request.param
def nO(request):
return request.param
def test_list2padded():
ops = NumpyOps()
seqs = [numpy.zeros((5, 4)), numpy.z... | 2 | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_lstm.py | test_LSTM_init_with_sizes | assert | none_literal | 19 | import numpy
import timeit
from thinc.api import minibatch, NumpyOps, LSTM, PyTorchLSTM, with_padded
from thinc.util import has_torch
import pytest
def nI(request):
return request.param
def nO(request):
return request.param
@pytest.mark.parametrize("nO,nI", [(1, 2), (2, 2), (100, 200), (9, 6)])
def test_LSTM... | None | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_lstm.py | test_LSTM_learns | assert | variable | 34 | import numpy
import timeit
from thinc.api import minibatch, NumpyOps, LSTM, PyTorchLSTM, with_padded
from thinc.util import has_torch
import pytest
def nI(request):
return request.param
def nO(request):
return request.param
def test_LSTM_learns():
nO = 2
nI = 2
model = with_padded(LSTM(nO, nI))
... | loss2 | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_lstm.py | test_LSTM_init_with_sizes | assert | collection | 33 | import numpy
import timeit
from thinc.api import minibatch, NumpyOps, LSTM, PyTorchLSTM, with_padded
from thinc.util import has_torch
import pytest
def nI(request):
return request.param
def nO(request):
return request.param
@pytest.mark.parametrize("nO,nI", [(1, 2), (2, 2), (100, 200), (9, 6)])
def test_LSTM... | (nO,) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_lstm.py | test_lstm_init | pytest.raises | variable | 17 | import numpy
import timeit
from thinc.api import minibatch, NumpyOps, LSTM, PyTorchLSTM, with_padded
from thinc.util import has_torch
import pytest
def nI(request):
return request.param
def nO(request):
return request.param
def test_lstm_init():
model = with_padded(LSTM(2, bi=True))
model.initialize(... | NotImplementedError) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_lstm.py | test_LSTM_fwd_bwd_shapes | assert | func_call | 22 | import numpy
import timeit
from thinc.api import minibatch, NumpyOps, LSTM, PyTorchLSTM, with_padded
from thinc.util import has_torch
import pytest
def nI(request):
return request.param
def nO(request):
return request.param
def test_LSTM_fwd_bwd_shapes(nO, nI):
nO = 1
nI = 2
model = with_padded(L... | numpy.vstack([X]).shape | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_mnist.py | test_small_end_to_end | assert | complex_expr | 53 | import pytest
from thinc.api import Model, ReLu, Softmax, chain, clone, Adam
from thinc.api import get_shuffled_batches, evaluate_model_on_arrays
import ml_datasets
def mnist(limit=1000):
(train_X, train_Y), (dev_X, dev_Y) = ml_datasets.mnist()
return (train_X[:limit], train_Y[:limit]), (dev_X[:limit], dev_Y[:... | losses[0] | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_mnist.py | test_small_end_to_end | assert | complex_expr | 54 | import pytest
from thinc.api import Model, ReLu, Softmax, chain, clone, Adam
from thinc.api import get_shuffled_batches, evaluate_model_on_arrays
import ml_datasets
def mnist(limit=1000):
(train_X, train_Y), (dev_X, dev_Y) = ml_datasets.mnist()
return (train_X[:limit], train_Y[:limit]), (dev_X[:limit], dev_Y[:... | scores[0] | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_pytorch_wrapper.py | check_learns_zero_output | assert | variable | 21 | from thinc.api import Linear, SGD, PyTorchWrapper, xp2torch, torch2xp, ArgsKwargs
from thinc.util import has_torch
import numpy
import pytest
from ..util import make_tempdir, check_input_converters
def check_learns_zero_output(model, sgd, X, Y):
"""Check we can learn to output a zero vector"""
Yh, get_dX = mo... | prev | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_pytorch_wrapper.py | test_wrapper | assert | collection | 36 | from thinc.api import Linear, SGD, PyTorchWrapper, xp2torch, torch2xp, ArgsKwargs
from thinc.util import has_torch
import numpy
import pytest
from ..util import make_tempdir, check_input_converters
def check_learns_zero_output(model, sgd, X, Y):
"""Check we can learn to output a zero vector"""
Yh, get_dX = mo... | (nN, nO) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_pytorch_wrapper.py | test_wrapper | assert | collection | 40 | from thinc.api import Linear, SGD, PyTorchWrapper, xp2torch, torch2xp, ArgsKwargs
from thinc.util import has_torch
import numpy
import pytest
from ..util import make_tempdir, check_input_converters
def check_learns_zero_output(model, sgd, X, Y):
"""Check we can learn to output a zero vector"""
Yh, get_dX = mo... | (nN, nI) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_sparse_linear.py | test_init | assert | numeric_literal | 27 | import numpy
import pytest
from thinc.api import SGD, NumpyOps, to_categorical, SparseLinear
def instances():
lengths = numpy.asarray([5, 4], dtype="int32")
keys = numpy.arange(9, dtype="uint64")
values = numpy.ones(9, dtype="float32")
X = (keys, values, lengths)
y = numpy.asarray([0, 2], dtype="in... | 3 | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_sparse_linear.py | test_basic | assert | variable | 27 | import numpy
import pytest
from thinc.api import SGD, NumpyOps, to_categorical, SparseLinear
def instances():
lengths = numpy.asarray([5, 4], dtype="int32")
keys = numpy.arange(9, dtype="uint64")
values = numpy.ones(9, dtype="float32")
X = (keys, values, lengths)
y = numpy.asarray([0, 2], dtype="in... | loss1 | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_sparse_linear.py | test_init | assert | collection | 25 | import numpy
import pytest
from thinc.api import SGD, NumpyOps, to_categorical, SparseLinear
def instances():
lengths = numpy.asarray([5, 4], dtype="int32")
keys = numpy.arange(9, dtype="uint64")
values = numpy.ones(9, dtype="float32")
X = (keys, values, lengths)
y = numpy.asarray([0, 2], dtype="in... | (2, 3) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_tensorflow_wrapper.py | test_tensorflow_wrapper_built_model | assert | string_literal | 54 | import numpy
import pytest
from thinc.api import TensorFlowWrapper, tensorflow2xp, xp2tensorflow, Linear
from thinc.api import Ops, get_current_ops, Model, Adam, ArgsKwargs
from thinc.types import Array
from thinc.util import has_tensorflow, to_categorical
from ..util import make_tempdir, check_input_converters
def ... | "" | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_tensorflow_wrapper.py | test_tensorflow_wrapper_built_model | assert | none_literal | 52 | import numpy
import pytest
from thinc.api import TensorFlowWrapper, tensorflow2xp, xp2tensorflow, Linear
from thinc.api import Ops, get_current_ops, Model, Adam, ArgsKwargs
from thinc.types import Array
from thinc.util import has_tensorflow, to_categorical
from ..util import make_tempdir, check_input_converters
def ... | None | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_tensorflow_wrapper.py | test_tensorflow_wrapper_thinc_model_subclass | assert | numeric_literal | 57 | import numpy
import pytest
from thinc.api import TensorFlowWrapper, tensorflow2xp, xp2tensorflow, Linear
from thinc.api import Ops, get_current_ops, Model, Adam, ArgsKwargs
from thinc.types import Array
from thinc.util import has_tensorflow, to_categorical
from ..util import make_tempdir, check_input_converters
def ... | 1337 | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_tensorflow_wrapper.py | test_tensorflow_wrapper_train_overfits | assert | variable | 60 | import numpy
import pytest
from thinc.api import TensorFlowWrapper, tensorflow2xp, xp2tensorflow, Linear
from thinc.api import Ops, get_current_ops, Model, Adam, ArgsKwargs
from thinc.types import Array
from thinc.util import has_tensorflow, to_categorical
from ..util import make_tempdir, check_input_converters
def ... | answer | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_tensorflow_wrapper.py | test_tensorflow_wrapper_thinc_set_model_name | assert | string_literal | 52 | import numpy
import pytest
from thinc.api import TensorFlowWrapper, tensorflow2xp, xp2tensorflow, Linear
from thinc.api import Ops, get_current_ops, Model, Adam, ArgsKwargs
from thinc.types import Array
from thinc.util import has_tensorflow, to_categorical
from ..util import make_tempdir, check_input_converters
def ... | "cool" | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_tensorflow_wrapper.py | test_tensorflow_wrapper_print_summary | assert | variable | 53 | import numpy
import pytest
from thinc.api import TensorFlowWrapper, tensorflow2xp, xp2tensorflow, Linear
from thinc.api import Ops, get_current_ops, Model, Adam, ArgsKwargs
from thinc.types import Array
from thinc.util import has_tensorflow, to_categorical
from ..util import make_tempdir, check_input_converters
def ... | summary | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_tensorflow_wrapper.py | test_tensorflow_wrapper_construction_requires_keras_model | pytest.raises | variable | 55 | import numpy
import pytest
from thinc.api import TensorFlowWrapper, tensorflow2xp, xp2tensorflow, Linear
from thinc.api import Ops, get_current_ops, Model, Adam, ArgsKwargs
from thinc.types import Array
from thinc.util import has_tensorflow, to_categorical
from ..util import make_tempdir, check_input_converters
def ... | ValueError) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_transforms.py | test_strings2arrays | assert | collection | 45 | from thinc.api import strings2arrays, NumpyOps, Ragged, registry
import numpy
import pytest
from ..util import get_data_checker
def shapes(request):
return request.param
def ops():
return NumpyOps()
def list_data(shapes):
return [numpy.zeros(shape, dtype="f") for shape in shapes]
def ragged_data(ops, l... | [] | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_transforms.py | test_strings2arrays | assert | func_call | 44 | from thinc.api import strings2arrays, NumpyOps, Ragged, registry
import numpy
import pytest
from ..util import get_data_checker
def shapes(request):
return request.param
def ops():
return NumpyOps()
def list_data(shapes):
return [numpy.zeros(shape, dtype="f") for shape in shapes]
def ragged_data(ops, l... | len(strings) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_uniqued.py | test_uniqued_doesnt_change_result | assert_* | variable | 41 | import pytest
import numpy
from thinc.layers import Embed
from ...layers.uniqued import uniqued
from numpy.testing import assert_allclose
from hypothesis import given
from hypothesis.strategies import integers, lists, composite
ROWS = 10
def lists_of_integers(draw, columns=2, lo=0, hi=ROWS):
# We call draw to get... | Z) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_uniqued.py | test_uniqued_doesnt_change_result | assert_* | variable | 33 | import pytest
import numpy
from thinc.layers import Embed
from ...layers.uniqued import uniqued
from numpy.testing import assert_allclose
from hypothesis import given
from hypothesis.strategies import integers, lists, composite
ROWS = 10
def lists_of_integers(draw, columns=2, lo=0, hi=ROWS):
# We call draw to get... | Yu) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_uniqued.py | test_uniqued_doesnt_change_result | assert_* | variable | 36 | import pytest
import numpy
from thinc.layers import Embed
from ...layers.uniqued import uniqued
from numpy.testing import assert_allclose
from hypothesis import given
from hypothesis.strategies import integers, lists, composite
ROWS = 10
def lists_of_integers(draw, columns=2, lo=0, hi=ROWS):
# We call draw to get... | dXu) | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
explosion/thinc | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | train | train | thinc/tests/layers/test_uniqued.py | test_uniqued_calls_init | assert | collection | 33 | import pytest
import numpy
from thinc.layers import Embed
from ...layers.uniqued import uniqued
from numpy.testing import assert_allclose
from hypothesis import given
from hypothesis.strategies import integers, lists, composite
ROWS = 10
def lists_of_integers(draw, columns=2, lo=0, hi=ROWS):
# We call draw to get... | [True] | 5591db91ff8e538ef16cbcd73f189eb83d60762b | 247 | v2_extractor_at_anchor |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.