Exemplo n.º 1
0
    def __init__(self, vocabs):
        self._vocabs = vocabs
        self._w_vocabs = widgets.Dropdown(options=vocabs.keys(),
                                          description="Vocab:")
        self._vocabs.link_dropdown(self._w_vocabs)

        self._emb_ctxs = CanonicalDict()
        self._w_emb_ctxs = widgets.Dropdown(options=[],
                                            description="Emb. Ctx.")
        self._emb_ctxs.link_dropdown(self._w_emb_ctxs)
        self._w_emb_ctxs.observe(self._selector_handler, names=["value"])

        self._w_ftr_name = widgets.Text(description="Feature:")
        self._w_emb_dim = widgets.IntText(value=512,
                                          min=1,
                                          max=9999,
                                          description="Emb. Dim.")

        self._w_emb_dropout = widgets.FloatText(value=0,
                                                min=0,
                                                max=1,
                                                description="Emb. Dropout")
        self._w_add_ctx_button = widgets.Button(description="Add Emb. Ctx.")
        self._w_del_ctx_button = widgets.Button(description="Del. Emb. Ctx.")
        self._w_add_ctx_button.on_click(self._add_ctx_handler)
        self._w_del_ctx_button.on_click(self._del_ctx_handler)

        self._w_main = widgets.VBox([
            self._w_emb_ctxs,
            widgets.HBox([self._w_ftr_name, self._w_vocabs]),
            widgets.HBox([self._w_emb_dim, self._w_emb_dropout]),
            widgets.HBox([self._w_add_ctx_button, self._w_del_ctx_button]),
        ])
Exemplo n.º 2
0
    def __init__(self, word_lists, params=None):

        self._vocabs = CanonicalDict()
        self._w_vocabs = widgets.Dropdown(options=[],
                                          description="Vocabs:")
        self._vocabs.link_dropdown(self._w_vocabs)
        self._w_vocabs.observe(self._selector_change, names=["value"])

        self._word_lists = word_lists
        self._w_word_lists = widgets.Dropdown(options=word_lists.keys(),
                                              description="Word Lists:")
        self._w_word_lists.observe(lambda x: self._select_word_list_callback(),
                                   names=["value"])
        self._word_lists.link_dropdown(self._w_word_lists)
        self._w_vocab_size = widgets.IntSlider(min=1, max=1, value=1,
                                               description="Max V. Size:")
        self._w_vocab_size.observe(lambda x: self._calculate_vocab_size(),
                                   names=["value"])
        self._w_min_count = widgets.IntSlider(min=1, max=1, value=1,
                                              description="Min Freq.:")
        self._w_min_count.observe(lambda x: self._calculate_vocab_size(),
                                  names=["value"])
        self._w_actual_vocab_size = widgets.Label(
            description="Actual V. Size:")
        self._w_unk_rate = widgets.Label()

        self._w_start_token = widgets.Text(value="<sos>",
                                           description="Start Tkn:")
        self._w_stop_token = widgets.Text(value="<eos>",
                                           description="Stop Tkn:")
        self._w_pad_token = widgets.Text(value="<pad>",
                                         description="Pad Tkn:")
        self._w_unk_token = widgets.Text(value="<unk>",
                                         description="Unk Tkn:")
        self._w_name = widgets.Text(
            value="target_vocab-{}".format(len(self._vocabs)),
            description="Name:")

        self._w_create = widgets.Button(description="Create")
        self._w_create.on_click(self._create_callback)

        self._w_delete = widgets.Button(description="Delete")
        self._w_delete.on_click(self._delete_callback)

        self._w_main = widgets.VBox([
            self._w_vocabs,
            widgets.HBox([self._w_word_lists, self._w_name]),
            widgets.HBox([self._w_min_count, self._w_vocab_size,]),
            widgets.HBox([self._w_start_token, self._w_stop_token]),
            widgets.HBox([self._w_pad_token, self._w_unk_token]),
            widgets.VBox([self._w_actual_vocab_size, 
                          self._w_unk_rate]),
            widgets.HBox([self._w_create, self._w_delete]),
        ])

        self._select_word_list_callback()
Exemplo n.º 3
0
    def __init__(self, params=None):

        self._w_datasets = widgets.Dropdown(options=[], description="Dataset:")
        self._w_dataset = Seq2SeqFileDatasetWidget()
        self._w_save = widgets.Button(description="Save")
        self._w_delete = widgets.Button(description="Delete")
        self._datasets = CanonicalDict()
        self._datasets.link_dropdown(self._w_datasets)

        self._w_main = widgets.VBox([
            self._w_datasets,
            self._w_dataset(),
            widgets.HBox([self._w_save, self._w_delete]),
        ])
        
        self._w_datasets.observe(self._selector_change, names=["value"])
        self._w_save.on_click(self._save_callback)
        self._w_delete.on_click(self._delete_callback)
    def __init__(self, vocabs):

        self._ecs = CanonicalDict()
        self._w_ecs = widgets.Dropdown(options=[], description="Emb. Ctxs.")
        self._ecs.link_dropdown(self._w_ecs)
        self._w_ecs.observe(self._selector_handler, names=["value"])
        self._w_ec = TargetEmbeddingContextWidget(vocabs)

        self._w_create = widgets.Button(description="Create")
        self._w_create.on_click(self._create_handler)
        self._w_delete = widgets.Button(description="Delete")
        self._w_delete.on_click(self._delete_handler)
        self._w_ec_name = widgets.Text(value="tgt-ec-{}".format(len(
            self._ecs)),
                                       description="Name:")

        self._w_main = widgets.VBox([
            self._w_ecs,
            self._w_ec(),
            self._w_ec_name,
            widgets.HBox([self._w_create, self._w_delete]),
        ])
Exemplo n.º 5
0
    def __init__(self, datasets, params=None):
        self._datasets = datasets
        self._word_lists = CanonicalDict()
        self._w_word_lists = widgets.Dropdown(options=[],
                                              description="Word Lists:")
        self._word_lists.link_dropdown(self._w_word_lists)
        #self._w_word_lists.observe(self._selector_change, names=["value"])

        self._w_datasets = widgets.Dropdown(options=datasets.keys(),
                                            description="Dataset:")
        self._datasets.link_dropdown(self._w_datasets)
        self._w_part = widgets.Dropdown(options=["source", "target"],
                                        description="Part")

        self._w_create = widgets.Button(description="Create")
        self._w_delete = widgets.Button(description="Delete")
        self._w_create.on_click(self._create_callback)

        self._w_main = widgets.VBox([
            self._w_word_lists,
            widgets.HBox([self._w_datasets, self._w_part]),
            widgets.HBox([self._w_create, self._w_delete]),
            widgets.Label(),
        ])