MCPcopy Create free account

hub / github.com/Hunter-DDM/knowledge-neurons / functions

Functions86 in github.com/Hunter-DDM/knowledge-neurons

↓ 30 callersMethodload
(module, prefix='')
src/custom_bert.py:451
↓ 14 callersMethod__init__
(self, config)
src/custom_bert.py:268
↓ 12 callersMethodfrom_pretrained
(cls, pretrained_model_name, state_dict=None, cache_dir=None, *inputs, **kwargs)
src/custom_bert.py:385
↓ 5 callersFunctionexample2feature
Convert an example into input features
src/6_edit_knowledge_sampled.py:30
↓ 4 callersFunctioncal_intersec
(kn_bag_1, kn_bag_2)
src/2_analyze_kn.py:96
↓ 4 callersFunctionexample2feature
Convert an example into input features
src/7_erase_knowledge.py:29
↓ 4 callersFunctionstat
(data, pos_type, rel)
src/2_get_kn.py:78
↓ 3 callersFunctionexample2feature_distant
Convert an example into input features
src/4_check_weights_distant.py:30
↓ 3 callersFunctionpos_list2str
(pos_list)
src/6_edit_knowledge_sampled.py:88
↓ 3 callersMethodtranspose_for_scores
(self, x)
src/custom_bert.py:169
↓ 2 callersFunctionanalysis_file
(filename, metric='ig_gold')
src/2_get_kn.py:42
↓ 2 callersFunctioncheck_weights
(prefix='')
src/4_check_weights_distant.py:287
↓ 2 callersFunctionconvert_to_triplet_ig
(ig_list)
src/1_analyze_mlm.py:86
↓ 2 callersFunctionexample2feature
Convert an example into input features
src/3_modify_activation.py:28
↓ 2 callersFunctionparse_kn
(pos_cnt, tot_num, mode_ratio, min_threshold=0)
src/2_get_kn.py:32
↓ 2 callersFunctionpos_list2str
(pos_list)
src/2_get_kn.py:24
↓ 1 callersFunctionedit
(rel, bag_idx, tgt_ent)
src/6_edit_knowledge_sampled.py:239
↓ 1 callersFunctionerase
(rel)
src/7_erase_knowledge.py:206
↓ 1 callersFunctioneval_modification
(prefix='')
src/3_modify_activation.py:201
↓ 1 callersFunctionexample2feature
Convert an example into input features
src/1_analyze_mlm.py:28
↓ 1 callersFunctionexample2feature_distant
Convert an example into input features
src/5_find_trigger_examples.py:30
↓ 1 callersMethodfrom_dict
Constructs a `BertConfig` from a Python dictionary of parameters.
src/custom_bert.py:80
↓ 1 callersMethodfrom_json_file
Constructs a `BertConfig` from a json file of parameters.
src/custom_bert.py:88
↓ 1 callersFunctionmain
()
src/6_edit_knowledge_sampled.py:96
↓ 1 callersFunctionmain
()
src/4_check_weights_distant.py:142
↓ 1 callersFunctionmain
()
src/3_modify_activation.py:86
↓ 1 callersFunctionmain
()
src/1_analyze_mlm.py:97
↓ 1 callersFunctionmain
()
src/5_find_trigger_examples.py:157
↓ 1 callersFunctionmain
()
src/7_erase_knowledge.py:95
↓ 1 callersFunctionmask_process_h
(bag_h, h)
src/4_check_weights_distant.py:105
↓ 1 callersFunctionmask_process_rd
(bag_rd)
src/4_check_weights_distant.py:130
↓ 1 callersFunctionmask_process_th
(bag_th, t, h)
src/4_check_weights_distant.py:86
↓ 1 callersFunctionmask_process_th
(bag_th, t, h)
src/5_find_trigger_examples.py:101
↓ 1 callersFunctionpos_list2str
(pos_list)
src/7_erase_knowledge.py:87
↓ 1 callersFunctionpos_str2list
(pos_str)
src/6_edit_knowledge_sampled.py:92
↓ 1 callersFunctionpos_str2list
(pos_str)
src/7_erase_knowledge.py:91
↓ 1 callersFunctionpos_str2list
(pos_str)
src/2_get_kn.py:28
↓ 1 callersFunctionre_filter
(metric_triplets)
src/2_get_kn.py:16
↓ 1 callersFunctionscaled_input
(emb, batch_size, num_batch)
src/1_analyze_mlm.py:75
↓ 1 callersFunctionselect_kn
(kn_bag, kn_bag_list)
src/6_edit_knowledge_sampled.py:218
↓ 1 callersMethodto_dict
Serializes this instance to a Python dictionary.
src/custom_bert.py:97
↓ 1 callersMethodto_json_string
Serializes this instance to a JSON string.
src/custom_bert.py:102
Method__init__
(self, vocab_size_or_config_json_file, hidden_size=768, num_hi
src/custom_bert.py:46
Method__init__
Construct a layernorm module in the TF style (epsilon inside the square root).
src/custom_bert.py:108
Method__init__
(self, config)
src/custom_bert.py:125
Method__init__
(self, config)
src/custom_bert.py:153
Method__init__
(self, config)
src/custom_bert.py:200
Method__init__
(self, config)
src/custom_bert.py:214
Method__init__
(self, config)
src/custom_bert.py:226
Method__init__
(self, config)
src/custom_bert.py:254
Method__init__
(self, config)
src/custom_bert.py:288
Method__init__
(self, config)
src/custom_bert.py:321
Method__init__
(self, config, bert_model_embedding_weights)
src/custom_bert.py:335
Method__init__
(self, config, bert_model_embedding_weights)
src/custom_bert.py:352
Method__init__
(self, config, *inputs, **kwargs)
src/custom_bert.py:363
Method__init__
(self, config)
src/custom_bert.py:475
Method__init__
(self, config)
src/custom_bert.py:520
Method__repr__
(self)
src/custom_bert.py:94
Functioncheck_h_t
(sent, h, t)
src/5_find_trigger_examples.py:86
Functioncheck_t
(sent, t)
src/5_find_trigger_examples.py:94
Methodforward
(self, x)
src/custom_bert.py:116
Methodforward
(self, input_ids, token_type_ids=None)
src/custom_bert.py:134
Methodforward
(self, hidden_states, attention_mask)
src/custom_bert.py:174
Methodforward
(self, hidden_states, input_tensor)
src/custom_bert.py:206
Methodforward
(self, input_tensor, attention_mask)
src/custom_bert.py:219
Methodforward
(self, hidden_states, tgt_pos=None, tmp_score=None, imp_pos=None, imp_op=None)
src/custom_bert.py:231
Methodforward
(self, hidden_states, input_tensor)
src/custom_bert.py:260
Methodforward
(self, hidden_states, attention_mask, tgt_pos=None, tmp_score=None, imp_pos=None, imp_op=None)
src/custom_bert.py:274
Methodforward
(self, hidden_states, attention_mask, tgt_layer=None, tgt_pos=None, tmp_score=None, imp_pos=None, imp_op=None)
src/custom_bert.py:292
Methodforward
(self, hidden_states)
src/custom_bert.py:327
Methodforward
(self, hidden_states)
src/custom_bert.py:345
Methodforward
(self, sequence_output)
src/custom_bert.py:356
Methodforward
(self, input_ids=None, attention_mask=None, token_type_ids=None, tgt_pos=None, tgt_layer=None, tmp_score=None,
src/custom_bert.py:481
Methodforward
(self, input_ids, token_type_ids=None, attention_mask=None, tgt_pos=None, tgt_layer=None, tmp_score=None, tgt_
src/custom_bert.py:526
Functiongelu
(x)
src/custom_bert.py:33
Methodinit_bert_weights
(self, module)
src/custom_bert.py:374
Functionmask_process_h
(bag_h, h)
src/5_find_trigger_examples.py:120
Functionmask_process_rd
(bag_rd)
src/5_find_trigger_examples.py:145
Functionpos_list2str
(pos_list)
src/2_analyze_kn.py:88
Functionpos_str2list
(pos_str)
src/2_analyze_kn.py:92
Functionscaled_input
(emb, batch_size, num_batch)
src/6_edit_knowledge_sampled.py:77
Functionscaled_input
(emb, batch_size, num_batch)
src/4_check_weights_distant.py:75
Functionscaled_input
(emb, batch_size, num_batch)
src/3_modify_activation.py:75
Functionscaled_input
(emb, batch_size, num_batch)
src/5_find_trigger_examples.py:75
Functionscaled_input
(emb, batch_size, num_batch)
src/7_erase_knowledge.py:76
Functionswish
(x)
src/custom_bert.py:37