MCPcopy Create free account

hub / github.com/THUDM/LongWriter / functions

Functions151 in github.com/THUDM/LongWriter

↓ 15 callersMethodget_command
(self, token)
train/patch/tokenization_chatglm.py:64
↓ 12 callersMethod__init__
(self, config)
train/patch/modeling_llama.py:233
↓ 9 callersMethod__init__
(self, config: ChatGLMConfig, device=None)
train/patch/modeling_chatglm.py:377
↓ 6 callersFunctionrepeat_kv
This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch, num_key_value_heads, seqlen, he
train/patch/modeling_llama.py:266
↓ 4 callersFunction_config_to_kwargs
(args)
train/patch/modeling_chatglm.py:362
↓ 4 callersFunctionapply_rotary_pos_emb
Applies Rotary Position Embedding to the query and key tensors. Args: q (`torch.Tensor`): The query tensor. k (`torch.Tensor`): T
train/patch/modeling_llama.py:205
↓ 3 callersMethodbuild_chat_input
(self, query, history=None, role="user")
train/patch/tokenization_chatglm.py:163
↓ 3 callersMethodbuild_single_message
(self, role, metadata, message)
train/patch/tokenization_chatglm.py:156
↓ 2 callersFunctionapply_rotary_pos_emb
(x: torch.Tensor, rope_cache: torch.Tensor)
train/patch/modeling_chatglm.py:137
↓ 2 callersFunctionrotate_half
Rotates half the hidden dims of the input.
train/patch/modeling_llama.py:198
↓ 1 callersMethod_convert_id_to_token
Converts an index (integer) in a token (str) using the vocab.
train/patch/tokenization_chatglm.py:118
↓ 1 callersMethod_dynamic_frequency_update
dynamic RoPE layers should recompute `inv_freq` in the following situations: 1 - growing beyond the cached sequence length (allow sca
train/patch/modeling_llama.py:131
↓ 1 callersMethod_get_layer
(self, layer_number)
train/patch/modeling_chatglm.py:515
↓ 1 callersFunction_resolve_path
(path: Union[str, Path])
trans_web_demo.py:33
↓ 1 callersMethod_update_causal_mask
( self, attention_mask: torch.Tensor, input_tensor: torch.Tensor, cache_positi
train/patch/modeling_llama.py:1065
↓ 1 callersFunctionbuild_input
(conversations, tokenizer, args)
train/pre_tokenize_llama3.py:28
↓ 1 callersFunctionbuild_input
(conversations, tokenizer, args)
train/pre_tokenize_glm4.py:27
↓ 1 callersMethodchat
(self, tokenizer, query: str, history: List[Dict] = None, role: str = "user", max_length: int = 8
train/patch/modeling_chatglm.py:876
↓ 1 callersFunctioncount_words
(text)
evaluation/pred.py:16
↓ 1 callersFunctionextract_info
(pattern, text)
evaluation/eval_quality.py:56
↓ 1 callersMethodforward
(self, x)
train/patch/modeling_llama.py:243
↓ 1 callersMethodforward_impl
Enhanced Transformer with Rotary Position Embedding. Derived from: https://github.com/labmlai/annotated_deep_learning_paper_implementations/b
train/patch/modeling_chatglm.py:103
↓ 1 callersMethodget_position_ids
(self, input_ids, device)
train/patch/modeling_chatglm.py:606
↓ 1 callersMethodget_prefix_tokens
(self)
train/patch/tokenization_chatglm.py:152
↓ 1 callersFunctionget_response_gpt4
(prompt, max_new_tokens=1024, temperature=1.0, stop=None)
agentwrite/write.py:18
↓ 1 callersFunctionget_response_gpt4
(prompt, max_new_tokens=1024, temperature=1.0, stop=None)
agentwrite/plan.py:18
↓ 1 callersFunctionget_response_gpt4
(prompt, temperature=0.5, max_new_tokens=1024, stop=None)
evaluation/eval_quality.py:18
↓ 1 callersFunctionload_model_and_tokenizer
( model_dir: Union[str, Path], trust_remote_code: bool = True )
trans_web_demo.py:37
↓ 1 callersFunctionmain
(args)
train/sort_and_group.py:19
↓ 1 callersFunctionmain
(args)
train/pre_tokenize_llama3.py:97
↓ 1 callersFunctionmain
(args)
train/pre_tokenize_glm4.py:92
↓ 1 callersFunctionmake_supervised_data_module
(data_args)
train/main.py:88
↓ 1 callersFunctionparse_args
(args=None)
train/sort_and_group.py:13
↓ 1 callersFunctionparse_args
(args=None)
train/pre_tokenize_llama3.py:22
↓ 1 callersFunctionparse_args
(args=None)
train/pre_tokenize_glm4.py:21
↓ 1 callersMethodprocess_data
(self, filepath)
train/dataset.py:13
↓ 1 callersMethodprocess_data
(self, filepath)
train/dataset.py:33
↓ 1 callersMethodprocess_data
(self, filepath)
train/dataset.py:52
↓ 1 callersMethodprocess_response
(self, response)
train/patch/modeling_chatglm.py:870
↓ 1 callersFunctionscore
(x, y)
evaluation/eval_length.py:5
↓ 1 callersFunctionseed_everything
(seed)
agentwrite/write.py:90
↓ 1 callersFunctionseed_everything
(seed)
agentwrite/plan.py:68
↓ 1 callersFunctionseed_everything
(seed)
evaluation/pred.py:53
↓ 1 callersFunctionsplit_tensor_along_last_dim
Split a tensor along its last dimension. Arguments: tensor: input tensor. num_partitions: number of partitions to split the tenso
train/patch/modeling_chatglm.py:66
↓ 1 callersFunctiontrain
()
train/main.py:102
Method__call__
(self, input_ids: torch.LongTensor, scores: torch.FloatTensor, **kwargs)
trans_web_demo.py:54
Method__call__
(self, instances: Sequence[Dict])
train/main.py:49
Method__call__
(self, instances)
train/main.py:68
Method__call__
(self, input_ids: torch.LongTensor, scores: torch.FloatTensor)
train/patch/modeling_chatglm.py:60
Method__getitem__
(self, idx)
train/dataset.py:18
Method__getitem__
(self, idx)
train/dataset.py:38
Method__getitem__
(self, idx)
train/dataset.py:63
Method__init__
(self, filepath)
train/dataset.py:8
Method__init__
(self, filepath)
train/dataset.py:28
Method__init__
(self, filepath)
train/dataset.py:48
Method__init__
( self, model = None, args: TrainingArguments = None, data_collator: Optional[
train/trainer.py:26
Method__init__
LlamaRMSNorm is equivalent to T5LayerNorm
train/patch/modeling_llama.py:67
Method__init__
( self, dim=None, max_position_embeddings=2048, base=10000, device=Non
train/patch/modeling_llama.py:87
Method__init__
(self, *args, **kwargs)
train/patch/modeling_llama.py:176
Method__init__
(self, *args, **kwargs)
train/patch/modeling_llama.py:188
Method__init__
(self, config: LlamaConfig, layer_idx: Optional[int] = None)
train/patch/modeling_llama.py:281
Method__init__
(self, *args, **kwargs)
train/patch/modeling_llama.py:417
Method__init__
(self, config: LlamaConfig, layer_idx: int)
train/patch/modeling_llama.py:711
Method__init__
(self, config: LlamaConfig)
train/patch/modeling_llama.py:923
Method__init__
(self, config)
train/patch/modeling_llama.py:1161
Method__init__
(self, config)
train/patch/modeling_llama.py:1393
Method__init__
(self, config)
train/patch/modeling_llama.py:1511
Method__init__
(self, config)
train/patch/modeling_llama.py:1607
Method__init__
(self, dim, rope_ratio=1, original_impl=False, device=None, dtype=None)
train/patch/modeling_chatglm.py:95
Method__init__
(self, normalized_shape, eps=1e-5, device=None, dtype=None, **kwargs)
train/patch/modeling_chatglm.py:158
Method__init__
(self, config: ChatGLMConfig, layer_number)
train/patch/modeling_chatglm.py:172
Method__init__
(self, config: ChatGLMConfig, layer_number, device=None)
train/patch/modeling_chatglm.py:229
Method__init__
(self, config: ChatGLMConfig, layer_number, device=None)
train/patch/modeling_chatglm.py:422
Method__init__
(self, config: ChatGLMConfig, device=None)
train/patch/modeling_chatglm.py:492
Method__init__
(self, config: ChatGLMConfig, device=None)
train/patch/modeling_chatglm.py:619
Method__init__
(self, config: ChatGLMConfig, device=None, empty_init=True)
train/patch/modeling_chatglm.py:645
Method__init__
(self, config: ChatGLMConfig, empty_init=True, device=None)
train/patch/modeling_chatglm.py:724
Method__init__
( self, vocab_file, padding_side="left", clean_up_tokenization
train/patch/tokenization_chatglm.py:17
Method__len__
(self)
train/dataset.py:24
Method__len__
(self)
train/dataset.py:44
Method__len__
(self)
train/dataset.py:70
Method_allocate_memory
(self, inference_max_sequence_len, batch_size, device=None, dtype=None)
train/patch/modeling_chatglm.py:258
Method_convert_token_to_id
Converts a token (str) in an id using the vocab.
train/patch/tokenization_chatglm.py:112
Method_get_train_sampler
(self)
train/trainer.py:52
Method_init_weights
(self, module)
train/patch/modeling_llama.py:825
Method_init_weights
Initialize the weights.
train/patch/modeling_chatglm.py:584
Method_pad
Pad encoded inputs (on left/right and up to predefined length or max length in the batch) Args: encoded_inputs:
train/patch/tokenization_chatglm.py:203
Method_reorder_cache
This function is used to re-order the `past_key_values` cache if [`~PreTrainedModel.beam_search`] or [`~PreTrainedModel.beam_sample`]
train/patch/modeling_chatglm.py:852
Method_set_gradient_checkpointing
(self, module, value=False)
train/patch/modeling_chatglm.py:611
Method_tokenize
(self, text, **kwargs)
train/patch/tokenization_chatglm.py:102
Method_update_model_kwargs_for_generation
( self, outputs: ModelOutput, model_kwargs: Dict[str, Any], is
train/patch/modeling_chatglm.py:732
Methodbuild_inputs_with_special_tokens
Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and adding special tokens
train/patch/tokenization_chatglm.py:178
Methodbuild_layer
(layer_number)
train/patch/modeling_chatglm.py:502
Methodconvert_tokens_to_string
Converts a sequence of tokens in a single string.
train/patch/tokenization_chatglm.py:82
Functiondefault_init
(cls, *args, **kwargs)
train/patch/modeling_chatglm.py:55
Methodeos_token_id
(self)
train/patch/tokenization_chatglm.py:73
Methodforward
(self, hidden_states)
train/patch/modeling_llama.py:75
Methodforward
(self, x, position_ids)
train/patch/modeling_llama.py:150
Methodforward
( self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor] = None,
train/patch/modeling_llama.py:316
Methodforward
( self, hidden_states: torch.Tensor, attention_mask: Optional[torch.LongTensor] = None
train/patch/modeling_llama.py:425
next →1–100 of 151, ranked by callers