MCPcopy Create free account

hub / github.com/WangXFng/RDRec / functions

Functions107 in github.com/WangXFng/RDRec

↓ 32 callersFunctionnow_time
()
utils/utils.py:544
↓ 7 callersFunction_split_into_words
Splits multiple sentences into words and flattens the result
utils/rouge.py:40
↓ 7 callersMethoddecode
Decodes a list of token IDs into a string. Args: t (List[int]): The list of token IDs to be decoded. Returns:
llama/llama/tokenizer.py:58
↓ 6 callersMethodbuild
Build a Llama instance by initializing and loading a pre-trained model. Args: ckpt_dir (str): Path to the directory cont
llama/llama/generation.py:53
↓ 5 callersMethodchat_completion
Generate assistant responses for a list of conversational dialogs using the language generation model. Args: dialogs (Li
llama/llama/generation.py:286
↓ 5 callersFunctioncompute_whole_word_id
(seq_batch, tokenizer, max_len)
utils/utils.py:66
↓ 4 callersMethod__init__
Initialize the RMSNorm normalization layer. Args: dim (int): The dimension of the input tensor. eps (float,
llama/llama/model.py:35
↓ 4 callersFunctionevaluate
(iterator)
pretrain.py:131
↓ 4 callersMethodforward
Forward pass through the RMSNorm layer. Args: x (torch.Tensor): The input tensor. Returns: torch.Te
llama/llama/model.py:65
↓ 4 callersMethodsample
(self, num)
utils/utils.py:106
↓ 3 callersMethodbeam_search
( self, task_id=None, input_ids=None, whole_word_ids=None, attention_m
model/module.py:116
↓ 3 callersMethodencode
Encodes a string into a list of token IDs. Args: s (str): The input string to be encoded. bos (bool): Whethe
llama/llama/tokenizer.py:38
↓ 3 callersFunctiongenerate_
( data, generator, max_batch_size, temperature: float = 0.6, top_p: float = 0.9, max_g
data/toys/distillation_toy.py:8
↓ 3 callersFunctiongenerate_
( data, generator, max_batch_size, temperature: float = 0.6, top_p: float = 0.9, max_g
data/sports/distillation_sports.py:8
↓ 3 callersFunctiongenerate_
( data, generator, max_batch_size, temperature: float = 0.6, top_p: float = 0.9, max_g
data/beauty/distillation_beauty.py:9
↓ 3 callersMethodinput_plus_whole_word
(self, input_ids, whole_word_ids)
model/module.py:31
↓ 3 callersMethodnext_batch_test
(self)
utils/utils.py:351
↓ 2 callersFunction_f_p_r_lcs
Computes the LCS-based F-measure score Source: http://research.microsoft.com/en-us/um/people/cyl/download/papers/ rouge-working-note-v1.3.1.pdf
utils/rouge.py:176
↓ 2 callersFunction_get_ngrams
Extracts all n-grams upto a given maximum order from an input segment. Args: segment: text segment from which n-grams will be extracted. ma
utils/bleu.py:16
↓ 2 callersFunction_get_word_ngrams
Calculates word n-grams for multiple sentences.
utils/rouge.py:45
↓ 2 callersFunction_lcs
Computes the length of the longest common subsequence (lcs) between two strings. The implementation below uses a DP programming algorithm and run
utils/rouge.py:73
↓ 2 callersMethodappend_prompt
(self, task_id, input_ids, whole_word_ids, attention_mask)
model/module.py:38
↓ 2 callersFunctionbleu_score
a list of lists of tokens
utils/utils.py:29
↓ 2 callersFunctionevaluate_hr
(user2item_test, user2items_top, top_k)
utils/utils.py:565
↓ 2 callersFunctionevaluate_ndcg
(user2item_test, user2items_top, top_k)
utils/utils.py:548
↓ 2 callersMethodgenerate
Generate text sequences based on provided prompts using the language generation model. Args: prompt_tokens (List[List[in
llama/llama/generation.py:132
↓ 2 callersFunctionids2tokens
(ids, tokenizer)
utils/utils.py:578
↓ 2 callersMethodnext_batch
(self)
utils/utils.py:334
↓ 2 callersMethodnext_batch
(self)
utils/utils.py:380
↓ 2 callersMethodnext_batch
(self, valid=True)
utils/utils.py:434
↓ 2 callersMethodnext_batch
(self, valid=True)
utils/utils.py:511
↓ 2 callersFunctionrepeat_kv
torch.repeat_interleave(x, dim=2, repeats=n_rep)
llama/llama/model.py:164
↓ 2 callersFunctionrouge_n
Computes ROUGE-N of two text collections of sentences. Sourece: http://research.microsoft.com/en-us/um/people/cyl/download/ papers/rouge-workin
utils/rouge.py:130
↓ 1 callersFunction_get_ngrams
Calcualtes n-grams. Args: n: which n-grams to calculate text: An array of tokens Returns: A set of n-grams
utils/rouge.py:22
↓ 1 callersFunction_len_lcs
Returns the length of the Longest Common Subsequence between sequences x and y. Source: http://www.algorithmist.com/index.php/Longest_Common_Su
utils/rouge.py:55
↓ 1 callersMethod_norm
Apply the RMSNorm normalization to the input tensor. Args: x (torch.Tensor): The input tensor. Returns:
llama/llama/model.py:52
↓ 1 callersFunction_recon
private recon calculation
utils/rouge.py:115
↓ 1 callersFunction_recon_lcs
Returns the Longest Subsequence between x and y. Source: http://www.algorithmist.com/index.php/Longest_Common_Subsequence Args: x: sequenc
utils/rouge.py:100
↓ 1 callersFunction_union_lcs
Returns LCS_u(r_i, C) which is the LCS score of the union longest common subsequence between reference sentence ri and candidate summary C. For e
utils/rouge.py:236
↓ 1 callersFunctionapply_rotary_emb
Apply rotary embeddings to input tensors using the given frequency tensor. This function applies rotary embeddings to the given query 'xq' a
llama/llama/model.py:132
↓ 1 callersMethodcheck_step
(self)
utils/utils.py:101
↓ 1 callersMethodcheck_step
(self)
utils/utils.py:128
↓ 1 callersMethodcheck_step
(self)
utils/utils.py:167
↓ 1 callersMethodcheck_step
(self)
utils/utils.py:215
↓ 1 callersFunctioncompute_bleu
Computes BLEU score of translated segments against one or more references. Args: reference_corpus: list of lists of references for each transla
utils/bleu.py:36
↓ 1 callersMethodencode
(self, task, input_list, output_list)
utils/utils.py:273
↓ 1 callersMethodencode
(self, input_list, output_list)
utils/utils.py:421
↓ 1 callersMethodencode
(self, input_list, output_list)
utils/utils.py:489
↓ 1 callersFunctiongenerate
()
exp.py:71
↓ 1 callersFunctiongenerate
()
seq.py:66
↓ 1 callersFunctiongenerate
()
topn.py:68
↓ 1 callersFunctiongenerate_
( sentence_category, generator, max_batch_size, temperature: float = 0.6, top_p: float = 0
llama/get_konwledge.py:43
↓ 1 callersFunctionget_requirements
(path: str)
llama/setup.py:7
↓ 1 callersMethodinit_prompt
(self, task_num, prompts_per_task, device)
model/module.py:21
↓ 1 callersMethodnext_batch
(self)
utils/utils.py:285
↓ 1 callersMethodnext_batch_valid
(self)
utils/utils.py:348
↓ 1 callersFunctionprecompute_freqs_cis
Precompute the frequency tensor for complex exponentials (cis) with given dimensions. This function calculates a frequency tensor with compl
llama/llama/model.py:80
↓ 1 callersFunctionreshape_for_broadcast
Reshape frequency tensor for broadcasting it with another tensor. This function reshapes the frequency tensor to have the same shape as the
llama/llama/model.py:107
↓ 1 callersFunctionrouge
Calculates average rouge scores for a list of hypotheses and references
utils/rouge.py:317
↓ 1 callersFunctionrouge_l_sentence_level
Computes ROUGE-L (sentence level) of two text collections of sentences. http://research.microsoft.com/en-us/um/people/cyl/download/papers/ roug
utils/rouge.py:199
↓ 1 callersFunctionrouge_score
both are a list of strings
utils/utils.py:11
↓ 1 callersMethodsample_negative
(self, user)
utils/utils.py:220
↓ 1 callersMethodsample_negative
(self, user)
utils/utils.py:502
↓ 1 callersMethodsample_seq
(self, u)
utils/utils.py:172
↓ 1 callersFunctionsample_top_p
Perform top-p (nucleus) sampling on a probability distribution. Args: probs (torch.Tensor): Probability distribution tensor.
llama/llama/generation.py:400
↓ 1 callersMethodtext_completion
Perform text completion for a list of prompts using the language generation model. Args: prompts (List[str]): List of te
llama/llama/generation.py:235
↓ 1 callersFunctiontrain
()
pretrain.py:97
Method__init__
(self, data_dir)
utils/utils.py:37
Method__init__
(self, data_dir)
utils/utils.py:47
Method__init__
(self, exp_data)
utils/utils.py:94
Method__init__
(self, exp_data)
utils/utils.py:121
Method__init__
(self, user2items_pos)
utils/utils.py:155
Method__init__
(self, user2items_pos, negative_num, item_num)
utils/utils.py:198
Method__init__
(self, exp_data, user2items_pos, negative_num, item_num, tokenizer, exp_len, batch_size, ratio)
utils/utils.py:251
Method__init__
(self, exp_data, tokenizer, exp_len, batch_size)
utils/utils.py:313
Method__init__
(self, exp_data, tokenizer, exp_len, batch_size)
utils/utils.py:356
Method__init__
(self, user2items_pos, tokenizer, batch_size)
utils/utils.py:406
Method__init__
(self, user2items_pos, user2items_neg, negative_num, item_num, tokenizer, batch_size=128)
utils/utils.py:466
Method__init__
Initializes the Tokenizer with a SentencePiece model. Args: model_path (str): The path to the SentencePiece model file.
llama/llama/tokenizer.py:16
Method__init__
(self, model: Transformer, tokenizer: Tokenizer)
llama/llama/generation.py:127
Method__init__
Initialize the Attention module. Args: args (ModelArgs): Model configuration parameters. Attributes:
llama/llama/model.py:178
Method__init__
Initialize the FeedForward module. Args: dim (int): Input dimension. hidden_dim (int): Hidden dimension of t
llama/llama/model.py:308
Method__init__
Initialize a TransformerBlock. Args: layer_id (int): Identifier for the layer. args (ModelArgs): Model confi
llama/llama/model.py:352
Method__init__
Initialize a Transformer model. Args: params (ModelArgs): Model configuration parameters. Attributes:
llama/llama/model.py:414
Method__init__
(self, config)
model/module.py:18
Methodforward
Forward pass of the attention module. Args: x (torch.Tensor): Input tensor. start_pos (int): Starting positi
llama/llama/model.py:253
Methodforward
(self, x)
llama/llama/model.py:347
Methodforward
Perform a forward pass through the TransformerBlock. Args: x (torch.Tensor): Input tensor. start_pos (int):
llama/llama/model.py:386
Methodforward
Perform a forward pass through the Transformer model. Args: tokens (torch.Tensor): Input token indices. star
llama/llama/model.py:457
Methodforward
( self, task_id=None, input_ids=None, whole_word_ids=None, attention_m
model/module.py:54
Functionmain
Entry point of the program for generating text using a pretrained model. Args: ckpt_dir (str): The directory containing checkpoint f
llama/example_chat_completion.py:12
Functionmain
Entry point of the program for generating text using a pretrained model. Args: ckpt_dir (str): The directory containing checkpoint f
llama/example_text_completion.py:9
Functionmain
( ckpt_dir: str = './llama/llama-2-7b-chat/', tokenizer_path: str = './llama/tokenizer.model', max
llama/get_konwledge.py:99
Functionmain
( ckpt_dir: str = 'llama-2-7b-chat/', tokenizer_path: str = 'tokenizer.model', max_seq_len: int =
data/toys/distillation_toy.py:93
Functionmain
( ckpt_dir: str = 'llama-2-7b-chat/', tokenizer_path: str = 'tokenizer.model', max_seq_len: int =
data/sports/distillation_sports.py:89
Functionmain
( ckpt_dir: str = 'llama-2-7b-chat/', tokenizer_path: str = 'tokenizer.model', max_seq_len: int =
data/beauty/distillation_beauty.py:90
Functionmake_label
(classes, aspect)
llama/get_konwledge.py:89
Methodnext_batch_test
(self)
utils/utils.py:400
Methodnext_batch_test
(self)
utils/utils.py:461
Methodnext_batch_test
(self)
utils/utils.py:540
next →1–100 of 107, ranked by callers