Ejemplo n.º 1
0
    def __init__(
        self,
        config: Config,
        dataset: Dataset,
        configuration_key=None,
        init_for_load_only=False,
    ):
        self._init_configuration(config, configuration_key)

        ent_emb_dim = self.get_option("entity_embedder.dim")
        ent_emb_conf_key = self.configuration_key + ".entity_embedder"
        round_ent_emb_dim_to = self.get_option("entity_embedder.round_dim_to")
        if len(round_ent_emb_dim_to) > 0:
            ent_emb_dim = round_to_points(round_ent_emb_dim_to, ent_emb_dim)
        config.set(ent_emb_conf_key + ".dim", ent_emb_dim, log=True)

        rescal_set_relation_embedder_dim(
            config, dataset, self.configuration_key + ".relation_embedder")

        super().__init__(
            config=config,
            dataset=dataset,
            scorer=RescalScorer,
            configuration_key=self.configuration_key,
            init_for_load_only=init_for_load_only,
        )
Ejemplo n.º 2
0
 def __init__(self,
              config,
              dataset,
              configuration_key,
              vocab_size,
              init_for_load_only=False):
     # TODO dropout is not applied to core tensor, but only to mixing matrices
     rescal_set_relation_embedder_dim(config, dataset, configuration_key)
     super().__init__(
         config,
         dataset,
         configuration_key,
         vocab_size,
         init_for_load_only=init_for_load_only,
     )