configuration file allenNLP

405 views Asked by At

I am trying to understand how to build configuration file for our experiements

let us take this example from the AllenNLP documentation

training and prediction

in particular this snippet

From where we got "token_embedders"? shouldn't be "basic" as documentation here?

or do I miss something?

1

There are 1 answers

0
Dirk Groeneveld On BEST ANSWER

There is a bit of a short-cut going on here. The long form would be this:

"model": {
  "type": "simple_classifier",
  "embedder": {
    "type": "basic",
    "token_embedders": {
      ...
    }
  }
}

BasicTextFieldEmbedder is the default implementation of TextFieldEmbedder, and that's why you don't have to explicitly say "type": "basic". "token_embedders" is simply a parameter of BasicTextFieldEmbedder.__init__(), as seen here: https://github.com/allenai/allennlp/blob/master/allennlp/modules/text_field_embedders/basic_text_field_embedder.py#L35