def from_params(cls, vocab: Vocabulary, params: Params) -> 'TreeAttention': embedder_params = params.pop("text_field_embedder") text_field_embedder = TextFieldEmbedder.from_params(vocab, embedder_params) premise_encoder_params = params.pop("premise_encoder", None) premise_encoder = Seq2SeqEncoder.from_params(premise_encoder_params) attention_similarity = SimilarityFunction.from_params(params.pop('attention_similarity')) phrase_probability = FeedForward.from_params(params.pop('phrase_probability')) edge_probability = FeedForward.from_params(params.pop('edge_probability')) edge_embedding = Embedding.from_params(vocab, params.pop('edge_embedding')) use_encoding_for_node = params.pop('use_encoding_for_node') ignore_edges = params.pop('ignore_edges', False) init_params = params.pop('initializer', None) initializer = (InitializerApplicator.from_params(init_params) if init_params is not None else InitializerApplicator()) return cls(vocab=vocab, text_field_embedder=text_field_embedder, phrase_probability=phrase_probability, edge_probability=edge_probability, premise_encoder=premise_encoder, edge_embedding=edge_embedding, use_encoding_for_node=use_encoding_for_node, attention_similarity=attention_similarity, ignore_edges=ignore_edges, initializer=initializer)
def from_params(cls, params: Params) -> 'Seq2Seq2VecEncoder': seq2seq_encoder_params = params.pop("seq2seq_encoder") seq2vec_encoder_params = params.pop("seq2vec_encoder") seq2seq_encoder = Seq2SeqEncoder.from_params(seq2seq_encoder_params) seq2vec_encoder = Seq2VecEncoder.from_params(seq2vec_encoder_params) return cls(seq2seq_encoder=seq2seq_encoder, seq2vec_encoder=seq2vec_encoder)