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/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/layers/test_uniqued.py
test_uniqued_calls_init
assert
collection
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...
[True, True]
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/layers/test_uniqued.py
test_uniqued_doesnt_change_result
pytest.raises
variable
40
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...
AssertionError)
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/layers/test_with_transforms.py
test_with_getitem
assert
func_call
120
import pytest import numpy from thinc.api import NumpyOps, Model, Linear from thinc.api import with_array, with_padded, with_list, with_ragged, with_getitem from thinc.types import Padded, Ragged from ..util import get_data_checker def shapes(request): return request.param def ops(): return NumpyOps() def l...
len(data)
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/model/test_model.py
test_model_init
assert
numeric_literal
54
import pytest import threading import time from thinc.api import Linear, NumpyOps, get_current_ops, use_device, Model, Shim from thinc.api import change_attr_values, set_dropout_rate import numpy from ..util import make_tempdir def model_with_no_args(): return Linear() def create_model(name): return Model(na...
10
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/model/test_model.py
_overload_plus
assert
collection
27
import pytest import threading import time from thinc.api import Linear, NumpyOps, get_current_ops, use_device, Model, Shim from thinc.api import change_attr_values, set_dropout_rate import numpy from ..util import make_tempdir def model_with_no_args(): return Linear() def create_model(name): return Model(na...
{}
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/model/test_model.py
test_model_init
assert
string_literal
64
import pytest import threading import time from thinc.api import Linear, NumpyOps, get_current_ops, use_device, Model, Shim from thinc.api import change_attr_values, set_dropout_rate import numpy from ..util import make_tempdir def model_with_no_args(): return Linear() def create_model(name): return Model(na...
"a"
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/model/test_model.py
test_set_dropout
assert
numeric_literal
22
import pytest import threading import time from thinc.api import Linear, NumpyOps, get_current_ops, use_device, Model, Shim from thinc.api import change_attr_values, set_dropout_rate import numpy from ..util import make_tempdir def model_with_no_args(): return Linear() def create_model(name): return Model(na...
0.2
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/model/test_model.py
test_model_init
assert
none_literal
34
import pytest import threading import time from thinc.api import Linear, NumpyOps, get_current_ops, use_device, Model, Shim from thinc.api import change_attr_values, set_dropout_rate import numpy from ..util import make_tempdir def model_with_no_args(): return Linear() def create_model(name): return Model(na...
None
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/model/test_model.py
test_change_attr_values
assert
bool_literal
22
import pytest import threading import time from thinc.api import Linear, NumpyOps, get_current_ops, use_device, Model, Shim from thinc.api import change_attr_values, set_dropout_rate import numpy from ..util import make_tempdir def model_with_no_args(): return Linear() def create_model(name): return Model(na...
True
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/model/test_model.py
_overload_plus
assert
string_literal
26
import pytest import threading import time from thinc.api import Linear, NumpyOps, get_current_ops, use_device, Model, Shim from thinc.api import change_attr_values, set_dropout_rate import numpy from ..util import make_tempdir def model_with_no_args(): return Linear() def create_model(name): return Model(na...
"ab"
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/model/test_model.py
test_model_set_reference
assert
variable
25
import pytest import threading import time from thinc.api import Linear, NumpyOps, get_current_ops, use_device, Model, Shim from thinc.api import change_attr_values, set_dropout_rate import numpy from ..util import make_tempdir def model_with_no_args(): return Linear() def create_model(name): return Model(na...
child
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/model/test_model.py
test_use_device
assert
variable
27
import pytest import threading import time from thinc.api import Linear, NumpyOps, get_current_ops, use_device, Model, Shim from thinc.api import change_attr_values, set_dropout_rate import numpy from ..util import make_tempdir def model_with_no_args(): return Linear() def create_model(name): return Model(na...
dev_id
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/model/test_model.py
test_param_names
assert
func_call
19
import pytest import threading import time from thinc.api import Linear, NumpyOps, get_current_ops, use_device, Model, Shim from thinc.api import change_attr_values, set_dropout_rate import numpy from ..util import make_tempdir def model_with_no_args(): return Linear() def create_model(name): return Model(na...
tuple()
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/mypy/test_mypy.py
test_mypy_results
assert
variable
68
import os import re from pathlib import Path import shutil import pytest from mypy import api as mypy_api GENERATE = False cases = [ ("mypy-plugin.ini", "success_plugin.py", "success-plugin.txt"), ("mypy-plugin.ini", "fail_plugin.py", "fail-plugin.txt"), ("mypy-default.ini", "success_no_plugin.py", "suc...
expected_err
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/mypy/test_mypy.py
test_mypy_results
assert
variable
66
import os import re from pathlib import Path import shutil import pytest from mypy import api as mypy_api GENERATE = False cases = [ ("mypy-plugin.ini", "success_plugin.py", "success-plugin.txt"), ("mypy-plugin.ini", "fail_plugin.py", "fail-plugin.txt"), ("mypy-default.ini", "success_no_plugin.py", "suc...
expected_out
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/mypy/test_mypy.py
test_mypy_results
assert
variable
69
import os import re from pathlib import Path import shutil import pytest from mypy import api as mypy_api GENERATE = False cases = [ ("mypy-plugin.ini", "success_plugin.py", "success-plugin.txt"), ("mypy-plugin.ini", "fail_plugin.py", "fail-plugin.txt"), ("mypy-default.ini", "success_no_plugin.py", "suc...
expected_returncode
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/regression/test_issue208.py
test_issue208
assert
numeric_literal
10
from thinc.api import chain, Linear def test_issue208(): """Test issue that was caused by trying to flatten nested chains.""" layer1 = Linear(nO=9, nI=3) layer2 = Linear(nO=12, nI=9) layer3 = Linear(nO=5, nI=12) model = chain(layer1, chain(layer2, layer3)) assert model.get_dim("nO") ==
5
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_config.py
test_fill_defaults_simple_config
assert
numeric_literal
101
import pytest from typing import Iterable, Union, Optional, List, Callable, Dict from types import GeneratorType from pydantic import BaseModel, StrictBool, StrictFloat, PositiveInt, constr import catalogue import thinc.config from thinc.config import ConfigValidationError from thinc.types import Generator from thinc.a...
1
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_config.py
test_fill_recursive_config
assert
numeric_literal
103
import pytest from typing import Iterable, Union, Optional, List, Callable, Dict from types import GeneratorType from pydantic import BaseModel, StrictBool, StrictFloat, PositiveInt, constr import catalogue import thinc.config from thinc.config import ConfigValidationError from thinc.types import Generator from thinc.a...
4
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_config.py
test_fill_recursive_config
assert
numeric_literal
104
import pytest from typing import Iterable, Union, Optional, List, Callable, Dict from types import GeneratorType from pydantic import BaseModel, StrictBool, StrictFloat, PositiveInt, constr import catalogue import thinc.config from thinc.config import ConfigValidationError from thinc.types import Generator from thinc.a...
7
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_config.py
test_create_registry
assert
numeric_literal
103
import pytest from typing import Iterable, Union, Optional, List, Callable, Dict from types import GeneratorType from pydantic import BaseModel, StrictBool, StrictFloat, PositiveInt, constr import catalogue import thinc.config from thinc.config import ConfigValidationError from thinc.types import Generator from thinc.a...
0
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_config.py
test_validation_fill_defaults
assert
numeric_literal
101
import pytest from typing import Iterable, Union, Optional, List, Callable, Dict from types import GeneratorType from pydantic import BaseModel, StrictBool, StrictFloat, PositiveInt, constr import catalogue import thinc.config from thinc.config import ConfigValidationError from thinc.types import Generator from thinc.a...
3
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_config.py
test_parse_args
assert
collection
100
import pytest from typing import Iterable, Union, Optional, List, Callable, Dict from types import GeneratorType from pydantic import BaseModel, StrictBool, StrictFloat, PositiveInt, constr import catalogue import thinc.config from thinc.config import ConfigValidationError from thinc.types import Generator from thinc.a...
[]
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_config.py
test_partials_from_config_nested
assert
numeric_literal
119
import pytest from typing import Iterable, Union, Optional, List, Callable, Dict from types import GeneratorType from pydantic import BaseModel, StrictBool, StrictFloat, PositiveInt, constr import catalogue import thinc.config from thinc.config import ConfigValidationError from thinc.types import Generator from thinc.a...
51
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_config.py
test_make_from_config_schema_coerced
assert
numeric_literal
108
import pytest from typing import Iterable, Union, Optional, List, Callable, Dict from types import GeneratorType from pydantic import BaseModel, StrictBool, StrictFloat, PositiveInt, constr import catalogue import thinc.config from thinc.config import ConfigValidationError from thinc.types import Generator from thinc.a...
5.0
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_config.py
test_read_config
assert
numeric_literal
102
import pytest from typing import Iterable, Union, Optional, List, Callable, Dict from types import GeneratorType from pydantic import BaseModel, StrictBool, StrictFloat, PositiveInt, constr import catalogue import thinc.config from thinc.config import ConfigValidationError from thinc.types import Generator from thinc.a...
0.9
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_config.py
test_read_config
assert
numeric_literal
103
import pytest from typing import Iterable, Union, Optional, List, Callable, Dict from types import GeneratorType from pydantic import BaseModel, StrictBool, StrictFloat, PositiveInt, constr import catalogue import thinc.config from thinc.config import ConfigValidationError from thinc.types import Generator from thinc.a...
0.1
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_config.py
test_read_config
assert
numeric_literal
105
import pytest from typing import Iterable, Union, Optional, List, Callable, Dict from types import GeneratorType from pydantic import BaseModel, StrictBool, StrictFloat, PositiveInt, constr import catalogue import thinc.config from thinc.config import ConfigValidationError from thinc.types import Generator from thinc.a...
128
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_loss.py
test_L1_distance
assert
numeric_literal
16
import pytest import numpy from thinc.api import CategoricalCrossentropy, SequenceCategoricalCrossentropy from thinc.api import L1Distance, CosineDistance from thinc import registry scores = numpy.zeros((3, 3), dtype="f") labels = numpy.asarray([0, 2, 2], dtype="i") def test_L1_distance(): vec1 = numpy.asarray([[...
2
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_loss.py
test_loss
assert
collection
18
import pytest import numpy from thinc.api import CategoricalCrossentropy, SequenceCategoricalCrossentropy from thinc.api import L1Distance, CosineDistance from thinc import registry scores = numpy.zeros((3, 3), dtype="f") labels = numpy.asarray([0, 2, 2], dtype="i") def test_loss(): d_scores = CategoricalCrossent...
[]
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_loss.py
test_loss
assert
string_literal
13
import pytest import numpy from thinc.api import CategoricalCrossentropy, SequenceCategoricalCrossentropy from thinc.api import L1Distance, CosineDistance from thinc import registry scores = numpy.zeros((3, 3), dtype="f") labels = numpy.asarray([0, 2, 2], dtype="i") def test_loss(): d_scores = CategoricalCrossent...
"float32"
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_loss.py
test_cosine_distance
assert
complex_expr
15
import pytest import numpy from thinc.api import CategoricalCrossentropy, SequenceCategoricalCrossentropy from thinc.api import L1Distance, CosineDistance from thinc import registry scores = numpy.zeros((3, 3), dtype="f") labels = numpy.asarray([0, 2, 2], dtype="i") def test_cosine_distance(): vec1 = numpy.asarra...
vec1.shape
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_loss.py
test_loss
assert
complex_expr
14
import pytest import numpy from thinc.api import CategoricalCrossentropy, SequenceCategoricalCrossentropy from thinc.api import L1Distance, CosineDistance from thinc import registry scores = numpy.zeros((3, 3), dtype="f") labels = numpy.asarray([0, 2, 2], dtype="i") def test_loss(): d_scores = CategoricalCrossent...
scores.shape
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_optimizers.py
test_optimizer_schedules_from_config
assert
numeric_literal
33
import pytest from thinc.api import registry, Optimizer import numpy def _test_schedule_valid(): while True: yield 0.456 def _test_schedule_invalid(): yield from [] def schedule_valid(request): # Use lambda to prevent iterator from being consumed by first test r_func, r1, r2, r3 = request.par...
1.0
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_optimizers.py
test_optimizer_schedules_from_config
assert
variable
27
import pytest from thinc.api import registry, Optimizer import numpy def _test_schedule_valid(): while True: yield 0.456 def _test_schedule_invalid(): yield from [] def schedule_valid(request): # Use lambda to prevent iterator from being consumed by first test r_func, r1, r2, r3 = request.par...
lr_next1
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_optimizers.py
test_optimizer_schedules_from_config
assert
variable
29
import pytest from thinc.api import registry, Optimizer import numpy def _test_schedule_valid(): while True: yield 0.456 def _test_schedule_invalid(): yield from [] def schedule_valid(request): # Use lambda to prevent iterator from being consumed by first test r_func, r1, r2, r3 = request.par...
lr_next2
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_optimizers.py
test_optimizer_schedules_from_config
assert
variable
31
import pytest from thinc.api import registry, Optimizer import numpy def _test_schedule_valid(): while True: yield 0.456 def _test_schedule_invalid(): yield from [] def schedule_valid(request): # Use lambda to prevent iterator from being consumed by first test r_func, r1, r2, r3 = request.par...
lr_next3
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_optimizers.py
test_optimizers_from_config
assert
variable
28
import pytest from thinc.api import registry, Optimizer import numpy def _test_schedule_valid(): while True: yield 0.456 def _test_schedule_invalid(): yield from [] def schedule_valid(request): # Use lambda to prevent iterator from being consumed by first test r_func, r1, r2, r3 = request.par...
learn_rate
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_optimizers.py
test_optimizer_schedules_invalid
pytest.raises
variable
24
import pytest from thinc.api import registry, Optimizer import numpy def _test_schedule_valid(): while True: yield 0.456 def _test_schedule_invalid(): yield from [] def schedule_valid(request): # Use lambda to prevent iterator from being consumed by first test r_func, r1, r2, r3 = request.par...
ValueError)
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_schedules.py
test_decaying_rate
assert
numeric_literal
11
from thinc.api import decaying, compounding, slanted_triangular, constant_then from thinc.api import constant, warmup_linear, cyclic_triangular def test_decaying_rate(): rates = decaying(0.001, 1e-4) rate = next(rates) assert rate == 0.001 next_rate = next(rates) assert next_rate < rate assert...
0
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_schedules.py
test_compounding_rate
assert
numeric_literal
8
from thinc.api import decaying, compounding, slanted_triangular, constant_then from thinc.api import constant, warmup_linear, cyclic_triangular def test_compounding_rate(): rates = compounding(1, 16, 1.01) rate0 = next(rates) assert rate0 ==
1.0
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_schedules.py
test_constant_then_schedule
assert
numeric_literal
9
from thinc.api import decaying, compounding, slanted_triangular, constant_then from thinc.api import constant, warmup_linear, cyclic_triangular def test_constant_then_schedule(): rates = constant_then(1.0, 2, [100, 200]) assert next(rates) == 1.0 assert next(rates) == 1.0 assert next(rates) ==
100
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_schedules.py
test_constant_then_schedule
assert
numeric_literal
10
from thinc.api import decaying, compounding, slanted_triangular, constant_then from thinc.api import constant, warmup_linear, cyclic_triangular def test_constant_then_schedule(): rates = constant_then(1.0, 2, [100, 200]) assert next(rates) == 1.0 assert next(rates) == 1.0 assert next(rates) == 100 ...
200
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_schedules.py
test_constant
assert
numeric_literal
7
from thinc.api import decaying, compounding, slanted_triangular, constant_then from thinc.api import constant, warmup_linear, cyclic_triangular def test_constant(): rates = constant(123) assert next(rates) ==
123
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_schedules.py
test_decaying_rate
assert
variable
10
from thinc.api import decaying, compounding, slanted_triangular, constant_then from thinc.api import constant, warmup_linear, cyclic_triangular def test_decaying_rate(): rates = decaying(0.001, 1e-4) rate = next(rates) assert rate == 0.001 next_rate = next(rates) assert next_rate <
rate
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_schedules.py
test_decaying_rate
assert
numeric_literal
8
from thinc.api import decaying, compounding, slanted_triangular, constant_then from thinc.api import constant, warmup_linear, cyclic_triangular def test_decaying_rate(): rates = decaying(0.001, 1e-4) rate = next(rates) assert rate ==
0.001
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_schedules.py
test_compounding_rate
assert
variable
12
from thinc.api import decaying, compounding, slanted_triangular, constant_then from thinc.api import constant, warmup_linear, cyclic_triangular def test_compounding_rate(): rates = compounding(1, 16, 1.01) rate0 = next(rates) assert rate0 == 1.0 rate1 = next(rates) rate2 = next(rates) rate3 = n...
rate2
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_schedules.py
test_slanted_triangular_rate
assert
variable
10
from thinc.api import decaying, compounding, slanted_triangular, constant_then from thinc.api import constant, warmup_linear, cyclic_triangular def test_slanted_triangular_rate(): rates = slanted_triangular(1.0, 20.0, ratio=10) rate0 = next(rates) assert rate0 < 1.0 rate1 = next(rates) assert rate...
rate0
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_schedules.py
test_slanted_triangular_rate
assert
variable
12
from thinc.api import decaying, compounding, slanted_triangular, constant_then from thinc.api import constant, warmup_linear, cyclic_triangular def test_slanted_triangular_rate(): rates = slanted_triangular(1.0, 20.0, ratio=10) rate0 = next(rates) assert rate0 < 1.0 rate1 = next(rates) assert rate1...
rate1
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_schedules.py
test_slanted_triangular_rate
assert
variable
14
from thinc.api import decaying, compounding, slanted_triangular, constant_then from thinc.api import constant, warmup_linear, cyclic_triangular def test_slanted_triangular_rate(): rates = slanted_triangular(1.0, 20.0, ratio=10) rate0 = next(rates) assert rate0 < 1.0 rate1 = next(rates) assert rate1...
rate3
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_schedules.py
test_decaying_rate
assert
func_call
12
from thinc.api import decaying, compounding, slanted_triangular, constant_then from thinc.api import constant, warmup_linear, cyclic_triangular def test_decaying_rate(): rates = decaying(0.001, 1e-4) rate = next(rates) assert rate == 0.001 next_rate = next(rates) assert next_rate < rate assert ...
next(rates)
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_schedules.py
test_warmup_linear
assert
complex_expr
9
from thinc.api import decaying, compounding, slanted_triangular, constant_then from thinc.api import constant, warmup_linear, cyclic_triangular def test_warmup_linear(): rates = warmup_linear(1.0, 2, 10) expected = [0.0, 0.5, 1.0, 0.875, 0.75, 0.625, 0.5, 0.375, 0.25, 0.125, 0.0] for i in range(11): ...
expected[i]
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_schedules.py
test_compounding_rate
assert
complex_expr
13
from thinc.api import decaying, compounding, slanted_triangular, constant_then from thinc.api import constant, warmup_linear, cyclic_triangular def test_compounding_rate(): rates = compounding(1, 16, 1.01) rate0 = next(rates) assert rate0 == 1.0 rate1 = next(rates) rate2 = next(rates) rate3 = n...
rate2 - rate1
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_serialize.py
test_pickle_with_flatten
assert
numeric_literal
16
import pytest import srsly from thinc.api import with_array, Linear, Maxout, chain, Model, Shim from thinc.api import serialize_attr, deserialize_attr def linear(): return Linear(5, 3) def test_pickle_with_flatten(linear): Xs = [linear.ops.alloc_f2d(2, 3), linear.ops.alloc_f2d(4, 3)] model = with_array(li...
2
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_serialize.py
test_simple_model_roundtrip_bytes
assert
numeric_literal
18
import pytest import srsly from thinc.api import with_array, Linear, Maxout, chain, Model, Shim from thinc.api import serialize_attr, deserialize_attr def linear(): return Linear(5, 3) def test_simple_model_roundtrip_bytes(): model = Maxout(5, 10, nP=2) b = model.get_param("b") b += 1 data = model...
1
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_serialize.py
test_simple_model_roundtrip_bytes_serializable_attrs
assert
string_literal
12
import pytest import srsly from thinc.api import with_array, Linear, Maxout, chain, Model, Shim from thinc.api import serialize_attr, deserialize_attr def linear(): return Linear(5, 3) def test_simple_model_roundtrip_bytes_serializable_attrs(): attr = SerializableAttr() assert attr.value ==
"foo"
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_serialize.py
test_simple_model_roundtrip_bytes_serializable_attrs
assert
string_literal
13
import pytest import srsly from thinc.api import with_array, Linear, Maxout, chain, Model, Shim from thinc.api import serialize_attr, deserialize_attr def linear(): return Linear(5, 3) def test_simple_model_roundtrip_bytes_serializable_attrs(): attr = SerializableAttr() assert attr.value == "foo" ass...
b"foo"
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_serialize.py
test_serialize_model_shims_roundtrip_bytes
assert
string_literal
14
import pytest import srsly from thinc.api import with_array, Linear, Maxout, chain, Model, Shim from thinc.api import serialize_attr, deserialize_attr def linear(): return Linear(5, 3) def test_serialize_model_shims_roundtrip_bytes(): test_shim = SerializableShim(None) shim_model = Model("shimmodel", lamb...
"shimdata"
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_serialize.py
test_serialize_refs_roundtrip_bytes
assert
collection
17
import pytest import srsly from thinc.api import with_array, Linear, Maxout, chain, Model, Shim from thinc.api import serialize_attr, deserialize_attr def linear(): return Linear(5, 3) def test_serialize_refs_roundtrip_bytes(): fwd = lambda X: (X, lambda dY: dY) model_a = Model("a", fwd) model = Model...
("a", "b")
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_serialize.py
test_serialize_model_shims_roundtrip_bytes
pytest.raises
variable
16
import pytest import srsly from thinc.api import with_array, Linear, Maxout, chain, Model, Shim from thinc.api import serialize_attr, deserialize_attr def linear(): return Linear(5, 3) def test_serialize_model_shims_roundtrip_bytes(): test_shim = SerializableShim(None) shim_model = Model("shimmodel", lamb...
ValueError)
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_serialize.py
test_simple_model_roundtrip_bytes_serializable_attrs
assert
string_literal
27
import pytest import srsly from thinc.api import with_array, Linear, Maxout, chain, Model, Shim from thinc.api import serialize_attr, deserialize_attr def linear(): return Linear(5, 3) def test_simple_model_roundtrip_bytes_serializable_attrs(): attr = SerializableAttr() assert attr.value == "foo" asse...
"foo from bytes"
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_serialize.py
test_serialize_model_shims_roundtrip_bytes
assert
string_literal
21
import pytest import srsly from thinc.api import with_array, Linear, Maxout, chain, Model, Shim from thinc.api import serialize_attr, deserialize_attr def linear(): return Linear(5, 3) def test_serialize_model_shims_roundtrip_bytes(): test_shim = SerializableShim(None) shim_model = Model("shimmodel", lamb...
"shimdata from bytes"
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_types.py
test_array_validation_invalid
pytest.raises
variable
16
import numpy from pydantic import create_model, ValidationError from thinc.types import Array1d, Array2d, Array3d, Array4d, ArrayNd import pytest @pytest.mark.parametrize( "arr,arr_type", [ (numpy.zeros((0, 0), dtype=numpy.float32), Array1d), (numpy.zeros((0, 0, 0, 0), dtype=numpy.float32), Arr...
ValidationError)
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_util.py
test_get_shuffled_batches
assert
numeric_literal
15
import pytest import numpy from thinc.api import get_width, Ragged, Padded, minibatch, get_shuffled_batches from thinc.api import Linear, evaluate_model_on_arrays, to_categorical from thinc.util import get_array_module, is_numpy_array, fix_random_seed from thinc.util import convert_recursive from thinc.types import Arg...
2
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_util.py
test_get_width
assert
variable
23
import pytest import numpy from thinc.api import get_width, Ragged, Padded, minibatch, get_shuffled_batches from thinc.api import Linear, evaluate_model_on_arrays, to_categorical from thinc.util import get_array_module, is_numpy_array, fix_random_seed from thinc.util import convert_recursive from thinc.types import Arg...
width
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_util.py
test_convert_recursive
assert
string_literal
17
import pytest import numpy from thinc.api import get_width, Ragged, Padded, minibatch, get_shuffled_batches from thinc.api import Linear, evaluate_model_on_arrays, to_categorical from thinc.util import get_array_module, is_numpy_array, fix_random_seed from thinc.util import convert_recursive from thinc.types import Arg...
"FOO"
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_util.py
test_to_categorical
assert
collection
14
import pytest import numpy from thinc.api import get_width, Ragged, Padded, minibatch, get_shuffled_batches from thinc.api import Linear, evaluate_model_on_arrays, to_categorical from thinc.util import get_array_module, is_numpy_array, fix_random_seed from thinc.util import convert_recursive from thinc.types import Arg...
(2, 3)
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_util.py
test_get_width_fail
pytest.raises
variable
12
import pytest import numpy from thinc.api import get_width, Ragged, Padded, minibatch, get_shuffled_batches from thinc.api import Linear, evaluate_model_on_arrays, to_categorical from thinc.util import get_array_module, is_numpy_array, fix_random_seed from thinc.util import convert_recursive from thinc.types import Arg...
ValueError)
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_util.py
test_to_categorical
assert
variable
23
import pytest import numpy from thinc.api import get_width, Ragged, Padded, minibatch, get_shuffled_batches from thinc.api import Linear, evaluate_model_on_arrays, to_categorical from thinc.util import get_array_module, is_numpy_array, fix_random_seed from thinc.util import convert_recursive from thinc.types import Arg...
expected_shape
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_util.py
test_convert_recursive
assert
collection
22
import pytest import numpy from thinc.api import get_width, Ragged, Padded, minibatch, get_shuffled_batches from thinc.api import Linear, evaluate_model_on_arrays, to_categorical from thinc.util import get_array_module, is_numpy_array, fix_random_seed from thinc.util import convert_recursive from thinc.types import Arg...
{"a": ["x", "FOO"]}
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_util.py
test_minibatch
assert
collection
13
import pytest import numpy from thinc.api import get_width, Ragged, Padded, minibatch, get_shuffled_batches from thinc.api import Linear, evaluate_model_on_arrays, to_categorical from thinc.util import get_array_module, is_numpy_array, fix_random_seed from thinc.util import convert_recursive from thinc.types import Arg...
[[1, 2, 3], [4, 5, 6]]
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_util.py
test_convert_recursive
assert
collection
21
import pytest import numpy from thinc.api import get_width, Ragged, Padded, minibatch, get_shuffled_batches from thinc.api import Linear, evaluate_model_on_arrays, to_categorical from thinc.util import get_array_module, is_numpy_array, fix_random_seed from thinc.util import convert_recursive from thinc.types import Arg...
("FOO", [{"b": "FOO"}])
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_util.py
test_minibatch
assert
collection
15
import pytest import numpy from thinc.api import get_width, Ragged, Padded, minibatch, get_shuffled_batches from thinc.api import Linear, evaluate_model_on_arrays, to_categorical from thinc.util import get_array_module, is_numpy_array, fix_random_seed from thinc.util import convert_recursive from thinc.types import Arg...
[[1, 2, 3], [4, 5], [6]]
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/test_util.py
test_convert_recursive
assert
collection
18
import pytest import numpy from thinc.api import get_width, Ragged, Padded, minibatch, get_shuffled_batches from thinc.api import Linear, evaluate_model_on_arrays, to_categorical from thinc.util import get_array_module, is_numpy_array, fix_random_seed from thinc.util import convert_recursive from thinc.types import Arg...
["FOO", {"e": "FOO", "f": (1, "FOO")}]
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/util.py
assert_lists_match
assert_*
variable
52
import contextlib from pathlib import Path import tempfile import shutil from thinc.api import Linear, Ragged, Padded, ArgsKwargs import numpy import pytest def make_tempdir(): d = Path(tempfile.mkdtemp()) yield d shutil.rmtree(str(d)) def get_model(W_b_input, cls=Linear): W, b, input_ = W_b_input ...
y)
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/util.py
assert_lists_match
assert
func_call
50
import contextlib from pathlib import Path import tempfile import shutil from thinc.api import Linear, Ragged, Padded, ArgsKwargs import numpy import pytest def make_tempdir(): d = Path(tempfile.mkdtemp()) yield d shutil.rmtree(str(d)) def get_model(W_b_input, cls=Linear): W, b, input_ = W_b_input ...
len(Y)
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/util.py
check_input_converters
assert
variable
81
import contextlib from pathlib import Path import tempfile import shutil from thinc.api import Linear, Ragged, Padded, ArgsKwargs import numpy import pytest def make_tempdir(): d = Path(tempfile.mkdtemp()) yield d shutil.rmtree(str(d)) def get_model(W_b_input, cls=Linear): W, b, input_ = W_b_input ...
n_args
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/util.py
assert_arrays_match
assert
complex_expr
42
import contextlib from pathlib import Path import tempfile import shutil from thinc.api import Linear, Ragged, Padded, ArgsKwargs import numpy import pytest def make_tempdir(): d = Path(tempfile.mkdtemp()) yield d shutil.rmtree(str(d)) def get_model(W_b_input, cls=Linear): W, b, input_ = W_b_input ...
Y.dtype
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/util.py
assert_raggeds_match
assert_*
complex_expr
59
import contextlib from pathlib import Path import tempfile import shutil from thinc.api import Linear, Ragged, Padded, ArgsKwargs import numpy import pytest def make_tempdir(): d = Path(tempfile.mkdtemp()) yield d shutil.rmtree(str(d)) def get_model(W_b_input, cls=Linear): W, b, input_ = W_b_input ...
Y.data)
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/util.py
assert_paddeds_match
assert
complex_expr
66
import contextlib from pathlib import Path import tempfile import shutil from thinc.api import Linear, Ragged, Padded, ArgsKwargs import numpy import pytest def make_tempdir(): d = Path(tempfile.mkdtemp()) yield d shutil.rmtree(str(d)) def get_model(W_b_input, cls=Linear): W, b, input_ = W_b_input ...
Y.lengths
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/util.py
assert_paddeds_match
assert
complex_expr
67
import contextlib from pathlib import Path import tempfile import shutil from thinc.api import Linear, Ragged, Padded, ArgsKwargs import numpy import pytest def make_tempdir(): d = Path(tempfile.mkdtemp()) yield d shutil.rmtree(str(d)) def get_model(W_b_input, cls=Linear): W, b, input_ = W_b_input ...
Y.indices
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/util.py
assert_arrays_match
assert
complex_expr
44
import contextlib from pathlib import Path import tempfile import shutil from thinc.api import Linear, Ragged, Padded, ArgsKwargs import numpy import pytest def make_tempdir(): d = Path(tempfile.mkdtemp()) yield d shutil.rmtree(str(d)) def get_model(W_b_input, cls=Linear): W, b, input_ = W_b_input ...
Y.shape[0]
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/util.py
assert_raggeds_match
assert_*
complex_expr
58
import contextlib from pathlib import Path import tempfile import shutil from thinc.api import Linear, Ragged, Padded, ArgsKwargs import numpy import pytest def make_tempdir(): d = Path(tempfile.mkdtemp()) yield d shutil.rmtree(str(d)) def get_model(W_b_input, cls=Linear): W, b, input_ = W_b_input ...
Y.lengths)
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/util.py
check_input_converters
assert
variable
82
import contextlib from pathlib import Path import tempfile import shutil from thinc.api import Linear, Ragged, Padded, ArgsKwargs import numpy import pytest def make_tempdir(): d = Path(tempfile.mkdtemp()) yield d shutil.rmtree(str(d)) def get_model(W_b_input, cls=Linear): W, b, input_ = W_b_input ...
kwargs_keys
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/util.py
assert_padded_data_match
assert_*
func_call
74
import contextlib from pathlib import Path import tempfile import shutil from thinc.api import Linear, Ragged, Padded, ArgsKwargs import numpy import pytest def make_tempdir(): d = Path(tempfile.mkdtemp()) yield d shutil.rmtree(str(d)) def get_model(W_b_input, cls=Linear): W, b, input_ = W_b_input ...
Padded(*Y))
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/util.py
assert_ragged_data_match
assert_*
func_call
77
import contextlib from pathlib import Path import tempfile import shutil from thinc.api import Linear, Ragged, Padded, ArgsKwargs import numpy import pytest def make_tempdir(): d = Path(tempfile.mkdtemp()) yield d shutil.rmtree(str(d)) def get_model(W_b_input, cls=Linear): W, b, input_ = W_b_input ...
Ragged(*Y))
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/util.py
assert_paddeds_match
assert
complex_expr
68
import contextlib from pathlib import Path import tempfile import shutil from thinc.api import Linear, Ragged, Padded, ArgsKwargs import numpy import pytest def make_tempdir(): d = Path(tempfile.mkdtemp()) yield d shutil.rmtree(str(d)) def get_model(W_b_input, cls=Linear): W, b, input_ = W_b_input ...
Y.data.dtype
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/util.py
assert_paddeds_match
assert_*
complex_expr
65
import contextlib from pathlib import Path import tempfile import shutil from thinc.api import Linear, Ragged, Padded, ArgsKwargs import numpy import pytest def make_tempdir(): d = Path(tempfile.mkdtemp()) yield d shutil.rmtree(str(d)) def get_model(W_b_input, cls=Linear): W, b, input_ = W_b_input ...
Y.size_at_t)
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
explosion/thinc
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
train
train
thinc/tests/util.py
assert_paddeds_match
assert
complex_expr
69
import contextlib from pathlib import Path import tempfile import shutil from thinc.api import Linear, Ragged, Padded, ArgsKwargs import numpy import pytest def make_tempdir(): d = Path(tempfile.mkdtemp()) yield d shutil.rmtree(str(d)) def get_model(W_b_input, cls=Linear): W, b, input_ = W_b_input ...
Y.data.shape[1]
5591db91ff8e538ef16cbcd73f189eb83d60762b
247
v2_extractor_at_anchor
eyurtsev/kor
7291946816782a70d2514445229a710eddcd7060
46
train
train
tests/documents/test_html.py
test_markdownify_html_preprocessor
assert
variable
45
from typing import Optional, Tuple import pytest from langchain.schema import Document from kor.documents.html import MarkdownifyHTMLProcessor @pytest.mark.parametrize( "tags,expected", [ (None, "Title\n\nTest"), # Use default (tuple(), "Title\nSvg\nStyle\nScript\n\nTest"), (("title"...
expected
7291946816782a70d2514445229a710eddcd7060
46
v2_extractor_at_anchor
eyurtsev/kor
7291946816782a70d2514445229a710eddcd7060
46
train
train
tests/documents/test_html.py
test_markdownify_html_preprocessor
assert
collection
46
from typing import Optional, Tuple import pytest from langchain.schema import Document from kor.documents.html import MarkdownifyHTMLProcessor @pytest.mark.parametrize( "tags,expected", [ (None, "Title\n\nTest"), # Use default (tuple(), "Title\nSvg\nStyle\nScript\n\nTest"), (("title"...
{"a": 1}
7291946816782a70d2514445229a710eddcd7060
46
v2_extractor_at_anchor
eyurtsev/kor
7291946816782a70d2514445229a710eddcd7060
46
train
train
tests/extraction/test_extraction_from_documents.py
test_extract_from_documents_with_extraction_uid_function
assert
string_literal
51
import asyncio from typing import List import pytest from langchain.docstore.document import Document from kor import ( DocumentExtraction, Object, Text, create_extraction_chain, extract_from_documents, ) from ..utils import ToyChatModel SIMPLE_TEXT_SCHEMA = Text( id="text_node", descrip...
"a!"
7291946816782a70d2514445229a710eddcd7060
46
v2_extractor_at_anchor
eyurtsev/kor
7291946816782a70d2514445229a710eddcd7060
46
train
train
tests/extraction/test_extraction_from_documents.py
test_check_assertion_is_raised_when_using_missing_uuid
pytest.raises
variable
35
import asyncio from typing import List import pytest from langchain.docstore.document import Document from kor import ( DocumentExtraction, Object, Text, create_extraction_chain, extract_from_documents, ) from ..utils import ToyChatModel SIMPLE_TEXT_SCHEMA = Text( id="text_node", descrip...
ValueError)
7291946816782a70d2514445229a710eddcd7060
46
v2_extractor_at_anchor
eyurtsev/kor
7291946816782a70d2514445229a710eddcd7060
46
train
train
tests/extraction/test_extraction_from_documents.py
test_extract_from_documents
assert
variable
95
import asyncio from typing import List import pytest from langchain.docstore.document import Document from kor import ( DocumentExtraction, Object, Text, create_extraction_chain, extract_from_documents, ) from ..utils import ToyChatModel SIMPLE_TEXT_SCHEMA = Text( id="text_node", descrip...
expected_results
7291946816782a70d2514445229a710eddcd7060
46
v2_extractor_at_anchor
eyurtsev/kor
7291946816782a70d2514445229a710eddcd7060
46
train
train
tests/extraction/test_extraction_with_chain.py
test_using_custom_template
assert
variable
43
from typing import Any, Mapping, Optional import langchain import pytest from langchain import PromptTemplate from langchain.chains import LLMChain from kor.encoders import CSVEncoder, JSONEncoder from kor.extraction import create_extraction_chain from kor.nodes import Object, Text from tests.utils import ToyChatMode...
string_value
7291946816782a70d2514445229a710eddcd7060
46
v2_extractor_at_anchor
eyurtsev/kor
7291946816782a70d2514445229a710eddcd7060
46
train
train
tests/extraction/test_extraction_with_chain.py
test_instantiation_with_verbose_flag
assert
variable
37
from typing import Any, Mapping, Optional import langchain import pytest from langchain import PromptTemplate from langchain.chains import LLMChain from kor.encoders import CSVEncoder, JSONEncoder from kor.extraction import create_extraction_chain from kor.nodes import Object, Text from tests.utils import ToyChatMode...
expected_verbose
7291946816782a70d2514445229a710eddcd7060
46
v2_extractor_at_anchor
eyurtsev/kor
7291946816782a70d2514445229a710eddcd7060
46
train
train
tests/extraction/test_extraction_with_chain.py
test_not_implemented_assertion_raised_for_csv
pytest.raises
variable
38
from typing import Any, Mapping, Optional import langchain import pytest from langchain import PromptTemplate from langchain.chains import LLMChain from kor.encoders import CSVEncoder, JSONEncoder from kor.extraction import create_extraction_chain from kor.nodes import Object, Text from tests.utils import ToyChatMode...
NotImplementedError)
7291946816782a70d2514445229a710eddcd7060
46
v2_extractor_at_anchor
eyurtsev/kor
7291946816782a70d2514445229a710eddcd7060
46
train
train
tests/extraction/test_extraction_with_chain.py
test_using_custom_template
assert
complex_expr
45
from typing import Any, Mapping, Optional import langchain import pytest from langchain import PromptTemplate from langchain.chains import LLMChain from kor.encoders import CSVEncoder, JSONEncoder from kor.extraction import create_extraction_chain from kor.nodes import Object, Text from tests.utils import ToyChatMode...
system_message.content
7291946816782a70d2514445229a710eddcd7060
46
v2_extractor_at_anchor
eyurtsev/kor
7291946816782a70d2514445229a710eddcd7060
46
train
train
tests/test_adapters.py
test_convert_pydantic_with_complex_union
pytest.raises
variable
25
import enum from typing import List, Union import pydantic import pytest from pydantic.fields import Field from kor.adapters import _translate_pydantic_to_kor, from_pydantic from kor.nodes import Number, Object, Option, Optional, Selection, Text def test_convert_pydantic_with_complex_union() -> None: """Test beh...
NotImplementedError)
7291946816782a70d2514445229a710eddcd7060
46
v2_extractor_at_anchor
eyurtsev/kor
7291946816782a70d2514445229a710eddcd7060
46
train
train
tests/test_adapters.py
test_from_pydantic
assert
collection
22
import enum from typing import List, Union import pydantic import pytest from pydantic.fields import Field from kor.adapters import _translate_pydantic_to_kor, from_pydantic from kor.nodes import Number, Object, Option, Optional, Selection, Text def test_from_pydantic() -> None: """Test from pydantic function.""...
(Toy(a="hello", b=5), [])
7291946816782a70d2514445229a710eddcd7060
46
v2_extractor_at_anchor