def create_model(cls, en_config, de_config): from blocks.encoders import TransformerEncoder encoder = nn.Embedding(en_config['vocab_size'], en_config['d_model']) decoder = TransformerEncoder(de_config) model = cls(encoder, decoder, de_config['vocab_size']) model.encoder.config = en_config return model
def create_model(cls, sp_config, en_config, vocab_size): from blocks.sp_layers import SPLayer from blocks.encoders import TransformerEncoder splayer = SPLayer(sp_config) encoder = TransformerEncoder(en_config) model = cls(splayer, encoder, vocab_size) return model
def create_model(cls, sp_config, en_config, as_cofig, vocab_size): from blocks.sp_layers import SPLayer from blocks.encoders import TransformerEncoder from blocks.attention_assigner import Attention_Assigner splayer = SPLayer(sp_config) encoder = TransformerEncoder(en_config) assigner = Attention_Assigner(as_cofig) model = cls(splayer, encoder, assigner, vocab_size) return model
def create_model(cls, sp_config, en_config, de_config): from blocks.sp_layers import SPLayer from blocks.encoders import TransformerEncoder from blocks.decoders import TransformerDecoder splayer = SPLayer(sp_config) encoder = TransformerEncoder(en_config) decoder = TransformerDecoder(de_config) model = cls(splayer, encoder, decoder) return model
def create_model(cls, sp_config, en_config, as_cofig, de_config): from blocks.sp_layers import SPLayer from blocks.encoders import TransformerEncoder from blocks.attention_assigner import Attention_Assigner from blocks.decoders import CIF_Decoder splayer = SPLayer(sp_config) encoder = TransformerEncoder(en_config) assigner = Attention_Assigner(as_cofig) decoder = CIF_Decoder(de_config) model = cls(splayer, encoder, assigner, decoder) return model