Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/Lancelot39/KGSF
/ functions
Functions
130 in github.com/Lancelot39/KGSF
⨍
Functions
130
◇
Types & classes
31
↓ 13 callers
Method
__init__
(self, dim=1, attn='cosine')
models/transformer.py:126
↓ 10 callers
Function
_normalize
Broadcast layer norm
models/transformer.py:18
↓ 9 callers
Method
__init__
(self, ninp, nhid, dropout=0.5)
models/graph.py:59
↓ 5 callers
Function
create_position_codes
(n_pos, dim, out)
models/transformer.py:114
↓ 5 callers
Method
data_process
(self,is_finetune=False)
dataset.py:136
↓ 5 callers
Method
padding_w2v
(self,sentence,max_length,transformer=True,pad=0,end=2,unk=3)
dataset.py:68
↓ 3 callers
Function
_build_encoder
(opt, dictionary, embedding=None, padding_idx=None, reduction=True, n_positions=1024)
models/transformer.py:23
↓ 3 callers
Method
backward
Perform a backward pass. It is recommended you use this instead of loss.backward(), for integration with distributed training and F
run.py:328
↓ 3 callers
Method
train
(self)
run.py:146
↓ 3 callers
Method
val
(self,is_test=False)
run.py:240
↓ 3 callers
Method
vector2sentence
(self,batch_sen)
run.py:573
↓ 3 callers
Method
zero_grad
Zero out optimizer. It is recommended you call this in train_step. It automatically handles gradient accumulation if age
run.py:359
↓ 2 callers
Function
_create_embeddings
Create and initialize word embeddings.
models/utils.py:31
↓ 2 callers
Method
_starts
Return bsz start tokens.
model.py:183
↓ 2 callers
Method
_starts
Return bsz start tokens.
models/transformer.py:1132
↓ 2 callers
Method
load_model
(self)
model.py:542
↓ 2 callers
Method
output
(self, tensor)
model.py:545
↓ 2 callers
Method
save_model
(self)
model.py:539
↓ 2 callers
Method
update_params
Perform step of optimization, clipping gradients and adjusting LR schedule if needed. Gradient accumulation is also performed if ag
run.py:336
↓ 2 callers
Method
val
(self,is_test=False)
run.py:458
↓ 1 callers
Function
_build_decoder4kg
(opt, dictionary, embedding=None, padding_idx=None, n_positions=1024)
models/transformer.py:96
↓ 1 callers
Method
_context_reformulate
(self,context,movies,altitude,ini_altitude,s_id,re_id)
dataset.py:238
↓ 1 callers
Function
_create_entity_embeddings
Create and initialize word embeddings.
models/utils.py:42
↓ 1 callers
Method
_create_selfattn_mask
(self, x)
models/transformer.py:701
↓ 1 callers
Method
_create_selfattn_mask
(self, x)
models/transformer.py:893
↓ 1 callers
Function
_edge_list
(kg, n_entity, hop)
model.py:29
↓ 1 callers
Method
backward
Perform a backward pass. It is recommended you use this instead of loss.backward(), for integration with distributed training and F
run.py:641
↓ 1 callers
Method
build_model
(self,is_finetune)
run.py:139
↓ 1 callers
Method
build_model
(self,is_finetune)
run.py:409
↓ 1 callers
Method
compute_loss
(self, output, scores)
model.py:533
↓ 1 callers
Function
concept_edge_list4GCN
()
model.py:54
↓ 1 callers
Method
decode_forced
Decode with a fixed, true sequence, computing loss. Useful for training, or ranking fixed candidates. :param ys:
model.py:259
↓ 1 callers
Method
decode_forced
Decode with a fixed, true sequence, computing loss. Useful for training, or ranking fixed candidates. :param ys:
models/transformer.py:1177
↓ 1 callers
Method
decode_greedy
Greedy search :param int bsz: Batch size. Because encoder_states is model-specific, it cannot infer thi
model.py:187
↓ 1 callers
Method
decode_greedy
Greedy search :param int bsz: Batch size. Because encoder_states is model-specific, it cannot infer thi
models/transformer.py:1136
↓ 1 callers
Method
detect_movie
(self,sentence,movies)
dataset.py:214
↓ 1 callers
Method
encode_cand
(self, words)
models/transformer.py:1054
↓ 1 callers
Method
encode_context_memory
(self, context_w, memories_w)
models/transformer.py:1072
↓ 1 callers
Method
infomax_loss
(self, con_nodes_features, db_nodes_features, con_user_emb, db_user_emb, con_label, db_label, mask)
model.py:315
↓ 1 callers
Method
init_optim
Initialize optimizer with model parameters. :param params: parameters from the model :param optim_states:
run.py:302
↓ 1 callers
Method
init_optim
Initialize optimizer with model parameters. :param params: parameters from the model :param optim_states:
run.py:615
↓ 1 callers
Function
kaiming_reset_parameters
(linear_module)
models/graph.py:14
↓ 1 callers
Method
metrics_cal_gen
(self,rec_loss,preds,responses,recs)
run.py:512
↓ 1 callers
Method
metrics_cal_rec
(self,rec_loss,scores,labels)
run.py:225
↓ 1 callers
Function
neginf
Returns a representable finite number near -inf for a dtype.
models/utils.py:24
↓ 1 callers
Method
optim_opts
Fetch optimizer selection. By default, collects everything in torch.optim, as well as importing: - qhm / qhmadam if inst
run.py:273
↓ 1 callers
Method
optim_opts
Fetch optimizer selection. By default, collects everything in torch.optim, as well as importing: - qhm / qhmadam if inst
run.py:586
↓ 1 callers
Method
padding_context
(self,contexts,pad=0,transformer=True)
dataset.py:101
↓ 1 callers
Method
reset_parameters
(self)
models/graph.py:37
↓ 1 callers
Method
response_delibration
(self,response,unk='MASKED_WORD')
dataset.py:127
↓ 1 callers
Function
setup_args
()
run.py:54
↓ 1 callers
Method
update_params
Perform step of optimization, clipping gradients and adjusting LR schedule if needed. Gradient accumulation is also performed if ag
run.py:649
↓ 1 callers
Method
zero_grad
Zero out optimizer. It is recommended you call this in train_step. It automatically handles gradient accumulation if age
run.py:672
Method
__getitem__
movie_vec = np.zeros(self.entity_num, dtype=np.float) context, c_lengths, response, r_length, entity, movie, concept_mask, dbpedia_
dataset.py:307
Method
__init__
(self, opt, is_finetune)
run.py:99
Method
__init__
(self, opt, is_finetune)
run.py:369
Method
__init__
(self,filename,opt)
dataset.py:12
Method
__init__
(self, dataset, entity_num, concept_num)
dataset.py:302
Method
__init__
(self, opt, dictionary, is_finetune=False, padding_idx=0, start_idx=1, end_idx=2, longest_label=1)
model.py:71
Method
__init__
(self, in_features, out_features, bias=True)
models/graph.py:26
Method
__init__
(self, in_features, out_features, dropout, alpha, concat=True)
models/graph.py:79
Method
__init__
(self, dim, da, alpha=0.2, dropout=0.5)
models/graph.py:116
Method
__init__
(self, dim, da, alpha=0.2, dropout=0.5)
models/graph.py:142
Method
__init__
(self, dim, da)
models/graph.py:172
Method
__init__
(self, input_size, dropout)
models/graph.py:193
Method
__init__
Dense version of GAT.
models/graph.py:221
Method
__init__
(self, in_features, out_features, dropout, alpha, concat=True)
models/graph.py:270
Method
__init__
Sparse version of GAT.
models/graph.py:331
Method
__init__
(self, n_heads, dim, dropout=0)
models/transformer.py:150
Method
__init__
(self, dim, dim_hidden, relu_dropout=0)
models/transformer.py:233
Method
__init__
(self, transformer, hdim)
models/transformer.py:250
Method
__init__
( self, n_heads, n_layers, embedding_size, ffn_size, dro
models/transformer.py:289
Method
__init__
( self, n_heads, embedding_size, ffn_size, attention_dropout=0.0,
models/transformer.py:367
Method
__init__
( self, n_heads, n_layers, embedding_size, ffn_size, voc
models/transformer.py:422
Method
__init__
( self, n_heads, n_layers, embedding_size, ffn_size, voc
models/transformer.py:544
Method
__init__
( self, n_heads, embedding_size, ffn_size, attention_dropout=0.0,
models/transformer.py:644
Method
__init__
( self, n_heads, n_layers, embedding_size, ffn_size, voc
models/transformer.py:736
Method
__init__
( self, n_heads, embedding_size, ffn_size, attention_dropout=0.0,
models/transformer.py:804
Method
__init__
( self, n_heads, n_layers, embedding_size, ffn_size, voc
models/transformer.py:928
Method
__init__
(self, opt, dictionary)
models/transformer.py:999
Method
__init__
( self, padding_idx=0, start_idx=1, end_idx=2, unknown_idx=3,
models/transformer.py:1117
Method
__len__
(self)
dataset.py:336
Method
__repr__
(self)
models/graph.py:53
Method
__repr__
(self)
models/graph.py:112
Method
__repr__
(self)
models/graph.py:327
Function
_add_neighbors
(kg, g, seed_set, hop)
models/graph.py:364
Function
_build_decoder
(opt, dictionary, embedding=None, padding_idx=None, n_positions=1024)
models/transformer.py:78
Function
_build_encoder4kg
(opt, padding_idx=None, reduction=True, n_positions=1024)
models/transformer.py:42
Function
_build_encoder_mask
(opt, dictionary, embedding=None, padding_idx=None, reduction=True, n_positions=1024)
models/transformer.py:59
Function
_load_kg_embeddings
(entity2entityId, dim, embedding_path)
model.py:15
Method
backward
(ctx, grad_output)
models/graph.py:250
Method
bleu_cal
(sen1, tar1)
run.py:513
Method
co_occurance_ext
(self,data)
dataset.py:160
Method
distinct_metrics
(outs)
run.py:520
Method
entities2ids
(self,entities)
dataset.py:211
Method
forward
Get output predictions from the model. :param xs: input to the encoder :type xs: LongTensor[bs
model.py:328
Method
forward
(self, input, adj)
models/graph.py:45
Method
forward
x: shape (|V|, |D|); adj: shape(|V|, |V|)
models/graph.py:66
Method
forward
(self, input, adj)
models/graph.py:94
Method
forward
(self, h)
models/graph.py:130
next →
1–100 of 130, ranked by callers