Esempio n. 1
0
 class Config(Model.Config):
     representation: Union[
         BiLSTMSlotAttention.Config, BSeqCNNRepresentation.Config,
         PassThroughRepresentation.Config, ] = BiLSTMSlotAttention.Config()
     output_layer: Union[
         WordTaggingOutputLayer.Config,
         CRFOutputLayer.Config] = WordTaggingOutputLayer.Config()
     decoder: MLPDecoder.Config = MLPDecoder.Config()
Esempio n. 2
0
    class Config(BaseModel.Config):
        class WordTaggingInputConfig(ConfigBase):
            tokens: RoBERTaTokenLevelTensorizer.Config = (
                RoBERTaTokenLevelTensorizer.Config())

        inputs: WordTaggingInputConfig = WordTaggingInputConfig()
        encoder: RoBERTaEncoderBase.Config = RoBERTaEncoderJit.Config()
        decoder: MLPDecoder.Config = MLPDecoder.Config()
        output_layer: WordTaggingOutputLayer.Config = WordTaggingOutputLayer.Config(
        )
Esempio n. 3
0
 def from_config(cls, config, tensorizers):
     labels = tensorizers["labels"].vocab
     embedding = cls.create_embedding(config, tensorizers)
     representation = create_module(config.representation,
                                    embed_dim=embedding.embedding_dim)
     decoder = create_module(
         config.decoder,
         in_dim=representation.representation_dim,
         out_dim=len(labels),
     )
     # TODO after migration: create_module(config.output_layer, tensorizers=tensorizers)
     output_layer = WordTaggingOutputLayer(labels, CrossEntropyLoss(None))
     return cls(embedding, representation, decoder, output_layer)
Esempio n. 4
0
    class Config(Model.Config):
        class ModelInput(Model.Config.ModelInput):
            tokens: TokenTensorizer.Config = TokenTensorizer.Config()
            labels: SlotLabelTensorizer.Config = SlotLabelTensorizer.Config()

        inputs: ModelInput = ModelInput()
        embedding: WordEmbedding.Config = WordEmbedding.Config()

        representation: Union[BiLSTMSlotAttention.
                              Config,  # TODO: make default when sorting solved
                              BSeqCNNRepresentation.Config,
                              PassThroughRepresentation.
                              Config, ] = PassThroughRepresentation.Config()
        output_layer: Union[
            WordTaggingOutputLayer.Config,
            CRFOutputLayer.Config] = WordTaggingOutputLayer.Config()
        decoder: MLPDecoder.Config = MLPDecoder.Config()