MCPcopy Create free account

hub / github.com/ByteDance-Seed/AHN / functions

Functions289 in github.com/ByteDance-Seed/AHN

Methodforward
(self, hidden_states)
src/ahn/transformer/qwen2/modeling_qwen2.py:220
Methodforward
( self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor] = None,
src/ahn/transformer/qwen2/modeling_qwen2.py:245
Methodforward
(self, x, position_ids)
src/ahn/transformer/qwen2/modeling_qwen2.py:308
Methodforward
( self, input_ids: Optional[torch.LongTensor] = None, attention_mask: Optional[torch.T
src/ahn/transformer/qwen2/modeling_qwen2.py:472
Methodforward
r""" labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*): Labels for computing the masked lan
src/ahn/transformer/qwen2/modeling_qwen2.py:771
Methodforward
r""" labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*): Labels for computing the sequence classification/regression
src/ahn/transformer/qwen2/modeling_qwen2.py:887
Methodforward
r""" labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*): Labels for computing the sequence classification/regression
src/ahn/transformer/qwen2/modeling_qwen2.py:992
Methodforward
r""" start_positions (`torch.LongTensor` of shape `(batch_size,)`, *optional*): Labels for position (index) of the start of the la
src/ahn/transformer/qwen2/modeling_qwen2.py:1063
Methodforward
(self, *args, **kwargs)
src/ahn/transformer/qwen2_ahn/qwen2_ahn.py:208
Methodforward
( self, input_ids: torch.LongTensor = None, attention_mask: Optional[torch.Tensor] = N
src/ahn/transformer/qwen2_ahn/qwen2_ahn.py:521
Methodforward
r""" Args: labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*): Labels for computing
src/ahn/transformer/qwen2_ahn/qwen2_ahn.py:779
Methodforward
( self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor] = None,
src/ahn/transformer/qwen2_ahn/qwen2_ahn.py:1134
Methodforward
(self, *args, **kwargs)
src/ahn/transformer/qwen3_ahn/qwen3_ahn.py:211
Methodforward
( self, input_ids: Optional[torch.LongTensor] = None, attention_mask: Optional[torch.T
src/ahn/transformer/qwen3_ahn/qwen3_ahn.py:524
Methodforward
r""" Args: labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*): Labels for computing
src/ahn/transformer/qwen3_ahn/qwen3_ahn.py:772
Methodforward
( self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor] = None,
src/ahn/transformer/qwen3_ahn/qwen3_ahn.py:1124
Methodforward
( self, hidden_states: torch.Tensor, q_states: torch.Tensor, k_states: torch.T
src/ahn/rnn/delta_net.py:176
Methodforward
( self, hidden_states: torch.Tensor, q_states: torch.Tensor, k_states: torch.T
src/ahn/rnn/mamba2.py:191
Methodforward
( self, hidden_states: torch.Tensor, q_states: torch.Tensor, k_states: torch.T
src/ahn/rnn/gated_deltanet.py:174
Methodfrom_pretrained
(cls, *args, **kwargs)
src/ahn/transformer/qwen3_ahn/qwen3_ahn.py:744
Methodget_beta_alpha
(self, hidden_states: torch.Tensor)
src/ahn/rnn/delta_net.py:172
Methodget_beta_alpha
(self, hidden_states: torch.Tensor)
src/ahn/rnn/gated_deltanet.py:167
Methodget_decoder
(self)
src/ahn/transformer/qwen3/modeling_qwen3.py:858
Methodget_decoder
(self)
src/ahn/transformer/qwen2/modeling_qwen2.py:764
Methodget_input_embeddings
(self)
src/ahn/transformer/qwen3/modeling_qwen3.py:492
Methodget_input_embeddings
(self)
src/ahn/transformer/qwen3/modeling_qwen3.py:843
Methodget_input_embeddings
(self)
src/ahn/transformer/qwen3/modeling_qwen3.py:973
Methodget_input_embeddings
(self)
src/ahn/transformer/qwen3/modeling_qwen3.py:1073
Methodget_input_embeddings
(self)
src/ahn/transformer/qwen3/modeling_qwen3.py:1149
Methodget_input_embeddings
(self)
src/ahn/transformer/qwen2/modeling_qwen2.py:464
Methodget_input_embeddings
(self)
src/ahn/transformer/qwen2/modeling_qwen2.py:749
Methodget_input_embeddings
(self)
src/ahn/transformer/qwen2/modeling_qwen2.py:879
Methodget_input_embeddings
(self)
src/ahn/transformer/qwen2/modeling_qwen2.py:979
Methodget_input_embeddings
(self)
src/ahn/transformer/qwen2/modeling_qwen2.py:1055
Methodget_output_embeddings
(self)
src/ahn/transformer/qwen3/modeling_qwen3.py:849
Methodget_output_embeddings
(self)
src/ahn/transformer/qwen2/modeling_qwen2.py:755
Functionget_score_one_code_run
Returns the score of one example in Code.Run.
eval/longbench/metrics.py:165
Methodget_vocab
(self)
src/ahn/transformer/qwen2/tokenization_qwen2.py:215
Functionload_jsonl
(data_path)
eval/lveval/utils.py:57
Functionload_model_and_tokenizer_serial
(num_gpus, args)
eval/lveval/pred.py:153
Methodmem_forward_inference
Args: hidden_states (`torch.FloatTensor`): input to the layer of shape `(batch, seq_len, embed_dim)` attention_mask (
src/ahn/transformer/qwen2_ahn/qwen2_ahn.py:1362
Methodmem_forward_inference
Args: hidden_states (`torch.FloatTensor`): input to the layer of shape `(batch, seq_len, embed_dim)` attention_mask (
src/ahn/transformer/qwen3_ahn/qwen3_ahn.py:1352
Methodmem_forward_train
Args: hidden_states (`torch.FloatTensor`): input to the layer of shape `(batch, seq_len, embed_dim)` attention_mask (
src/ahn/transformer/qwen2_ahn/qwen2_ahn.py:1215
Methodmem_forward_train
Args: hidden_states (`torch.FloatTensor`): input to the layer of shape `(batch, seq_len, embed_dim)` attention_mask (
src/ahn/transformer/qwen3_ahn/qwen3_ahn.py:1205
Functionmultiple_processing_once
(num_gpus, dataset, shared_dict, device_dict, args)
eval/lveval/pred.py:131
Functionnew_backward
Custom backward function with retain_graph=True by default. Calls the original backward method.
src/ahn/utils.py:17
Methodprepare_for_tokenization
(self, text, **kwargs)
src/ahn/transformer/qwen2/tokenization_qwen2.py:337
Functionqa_f1_score
(prediction, ground_truth, **kwargs)
eval/longbench/metrics.py:147
Functionqa_f1_score
(prediction, ground_truth, gold_ans=None, **kwargs)
eval/lveval/metrics.py:103
Functionqa_f1_score_factrecall
(prediction, ground_truth, gold_ans=None, **kwargs)
eval/lveval/metrics.py:110
Functionqa_f1_score_with_gold_ans
(prediction, ground_truth, gold_ans=None, **kwargs)
eval/lveval/metrics.py:121
Functionqa_f1_zh_score
(prediction, ground_truth, **kwargs)
eval/longbench/metrics.py:156
Functionqa_f1_zh_score
(prediction, ground_truth, gold_ans=None, **kwargs)
eval/lveval/metrics.py:138
Functionqa_f1_zh_score_factrecall
(prediction, ground_truth, gold_ans=None, **kwargs)
eval/lveval/metrics.py:147
Functionqa_f1_zh_score_with_gold_ans
(prediction, ground_truth, gold_ans=None, **kwargs)
eval/lveval/metrics.py:159
Functionregister_custom_accelerator
()
src/ahn/utils.py:10
Functionreshape_into_chunks
Padding input_tensor with `pad_size` on the seq_len dim (dim=1) and simultaneously splitting it into chunk sequences. Assumes that we on
src/ahn/rnn/mamba2.py:71
Functionretrieval_score
(prediction, ground_truth, **kwargs)
eval/longbench/metrics.py:68
Functionretrieval_zh_score
(prediction, ground_truth, **kwargs)
eval/longbench/metrics.py:81
Functionrouge_zh_score
(prediction, ground_truth, **kwargs)
eval/longbench/metrics.py:129
Functionrouge_zh_score
(prediction, ground_truth, gold_ans=None, **kwargs)
eval/lveval/metrics.py:73
Functionrouge_zh_score_blacklist
(prediction, ground_truth, gold_ans=None, **kwargs)
eval/lveval/metrics.py:79
Methodsample_num_attn_sinks
( sliding_window: int, candidates: list = [0, 32, 64, 128, 512, 2048,
src/ahn/transformer/qwen2_ahn/qwen2_ahn.py:479
Methodsample_num_attn_sinks
( sliding_window: int, candidates: list = [0, 32, 64, 128, 512, 2048,
src/ahn/transformer/qwen3_ahn/qwen3_ahn.py:482
Methodsample_window_size
( seq_len: str, candidates: list = [32, 64, 128, 256, 512, 1024, 2048,
src/ahn/transformer/qwen2_ahn/qwen2_ahn.py:459
Methodsample_window_size
( seq_len: str, candidates: list = [32, 64, 128, 256, 512, 1024, 2048,
src/ahn/transformer/qwen3_ahn/qwen3_ahn.py:462
Methodsave_pretrained
(self, save_directory, state_dict, **kwargs)
src/ahn/transformer/qwen3_ahn/qwen3_ahn.py:729
Methodsave_vocabulary
(self, save_directory: str, filename_prefix: Optional[str] = None)
src/ahn/transformer/qwen2/tokenization_qwen2_fast.py:132
Methodsave_vocabulary
(self, save_directory: str, filename_prefix: Optional[str] = None)
src/ahn/transformer/qwen2/tokenization_qwen2.py:308
Functionsegment_sum
More stable segment sum calculation. Uses cumulative sums and masking instead of direct subtractions.
src/ahn/rnn/mamba2.py:92
Methodset_decoder
(self, decoder)
src/ahn/transformer/qwen3/modeling_qwen3.py:855
Methodset_decoder
(self, decoder)
src/ahn/transformer/qwen2/modeling_qwen2.py:761
Methodset_input_embeddings
(self, value)
src/ahn/transformer/qwen3/modeling_qwen3.py:495
Methodset_input_embeddings
(self, value)
src/ahn/transformer/qwen3/modeling_qwen3.py:846
Methodset_input_embeddings
(self, value)
src/ahn/transformer/qwen3/modeling_qwen3.py:976
Methodset_input_embeddings
(self, value)
src/ahn/transformer/qwen3/modeling_qwen3.py:1076
Methodset_input_embeddings
(self, value)
src/ahn/transformer/qwen3/modeling_qwen3.py:1152
Methodset_input_embeddings
(self, value)
src/ahn/transformer/qwen2/modeling_qwen2.py:467
Methodset_input_embeddings
(self, value)
src/ahn/transformer/qwen2/modeling_qwen2.py:752
Methodset_input_embeddings
(self, value)
src/ahn/transformer/qwen2/modeling_qwen2.py:882
Methodset_input_embeddings
(self, value)
src/ahn/transformer/qwen2/modeling_qwen2.py:982
Methodset_input_embeddings
(self, value)
src/ahn/transformer/qwen2/modeling_qwen2.py:1058
Methodset_output_embeddings
(self, new_embeddings)
src/ahn/transformer/qwen3/modeling_qwen3.py:852
Methodset_output_embeddings
(self, new_embeddings)
src/ahn/transformer/qwen2/modeling_qwen2.py:758
Functionstr_to_dtype
(name: str)
examples/scripts/utils/merge_weights.py:47
Functionsum_norm
(x)
src/ahn/rnn/delta_net.py:37
Functionsum_norm
(x)
src/ahn/rnn/gated_deltanet.py:41
Methodtrim_cache
(self, num_attn_sinks: int, num_cached_tokens: int)
src/ahn/utils.py:137
Methodvocab_size
(self)
src/ahn/transformer/qwen2/tokenization_qwen2.py:211
← previous201–289 of 289, ranked by callers