Skip to content

Config.cfg Execution Logic #9355

Discussion options

You must be logged in to vote

Hey koayst ✨,
I think, the missing piece to better understand how the config system works is the Registry, where you can map strings like rel_model.v1 to a function which, in this case, would return a thinc model. You can also assign additional parameters when creating new registries. Here's the example from the REL code:

@spacy.registry.architectures("rel_model.v1")
def create_relation_model(
    create_instance_tensor: Model[List[Doc], Floats2d],
    classification_layer: Model[Floats2d, Floats2d],
) -> Model[List[Doc], Floats2d]:
    with Model.define_operators({">>": chain}):
        model = create_instance_tensor >> classification_layer
        model.attrs["get_instances"] = create_i…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by thomashacker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
usage General spaCy usage feat / config Feature: Training config
2 participants