Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/HazyResearch/prefix-linear-attention
/ functions
Functions
1,739 in github.com/HazyResearch/prefix-linear-attention
⨍
Functions
1,739
◇
Types & classes
329
↳
Endpoints
21
↓ 432 callers
Method
to
r"""Move internal buffers of the ExponentialMovingAverage to `device`. Args: device: like `device` argument to `torch.Tensor.to`
based/utils/ema.py:195
↓ 103 callers
Method
get
Retrieves a single item from the dataset with the option to only return a portion of the item. get(idx) is the same as [idx] but get(
train/src/datamodules/datasets/indexed_dataset.py:531
↓ 102 callers
Method
store
Save the current parameters for restoring later. Args: parameters: Iterable of `torch.nn.Parameter`; the parameters to be
based/utils/ema.py:123
↓ 60 callers
Method
apply
Defines the operation to perform on a list of the `inst.resps` properties of `Instance` objects. Should return the list of (filtered)
lm-eval-harness/lm_eval/api/filter.py:23
↓ 60 callers
Method
to
r"""Move internal buffers of the ExponentialMovingAverage to `device`. Args: device: like `device` argument to `torch.Tensor.to`
train/src/utils/ema.py:195
↓ 38 callers
Method
update
(self, preds: Tensor, target: Tensor, loss: Optional[Tensor] = None)
train/src/metrics/num_tokens.py:27
↓ 36 callers
Method
instantiate
(self, **kwargs)
synthetic/zoology/config.py:64
↓ 35 callers
Method
log
(self, metrics: dict)
synthetic/zoology/logger.py:48
↓ 29 callers
Method
size
(self, index)
train/src/datamodules/datasets/indexed_dataset.py:213
↓ 28 callers
Method
exists
(path)
train/src/datamodules/datasets/indexed_dataset.py:217
↓ 25 callers
Method
device
(self)
lm-eval-harness/lm_eval/models/huggingface.py:394
↓ 25 callers
Method
feature_map
Random feature map
synthetic/zoology/mixers/feature_maps/performer.py:103
↓ 25 callers
Method
from_pretrained
Instantiate a GPTPreTrainedModel from a pre-trained model file or a pytorch state dict. Download and cache the pre-trained model file
train/src/models/gpt.py:439
↓ 25 callers
Function
maybe_align
Assume that x already has last dim divisible by alignment_in_bytes
based/ops/layer_norm.py:9
↓ 19 callers
Function
print_rank_zero
(*args, **kwargs)
train/src/utils/utils.py:131
↓ 18 callers
Method
store
Save the current parameters for restoring later. Args: parameters: Iterable of `torch.nn.Parameter`; the parameters to be
train/src/utils/ema.py:123
↓ 17 callers
Method
read
( self, file, get_meta: bool = False, autojoin_paragraphs: bool = True,
lm-eval-harness/lm_eval/decontamination/archiver.py:54
↓ 16 callers
Method
write
(self, sizes, doc_idx)
train/src/datamodules/datasets/indexed_dataset.py:380
↓ 12 callers
Method
add_partial
(self, attr, req, res)
lm-eval-harness/lm_eval/api/model.py:168
↓ 11 callers
Method
load_state_dict
(self, state_dict, strict=True)
train/src/models/gpt.py:856
↓ 9 callers
Method
__init__
TD [2021-10-27] act_fn takes precedence over act_layer if set. This is to support Pytorch 1.10 Transformer interface that construct the activa
based/models/modules/seq_common.py:210
↓ 9 callers
Method
__init__
TD [2021-10-27] act_fn takes precedence over act_layer if set. This is to support Pytorch 1.10 Transformer interface that construct the activa
train/src/models/modules/seq_common.py:210
↓ 8 callers
Method
doc_to_target
(self, doc)
lm-eval-harness/lm_eval/api/task.py:348
↓ 8 callers
Method
doc_to_target
(self, doc: dict)
lm-eval-harness/lm_eval/api/task.py:1049
↓ 8 callers
Method
state_dict
r"""Returns the state of the ExponentialMovingAverage as a dict.
based/utils/ema.py:216
↓ 7 callers
Function
data_file_path
(prefix_path)
train/src/datamodules/datasets/indexed_dataset.py:124
↓ 7 callers
Method
doc_to_choice
(self, doc: Any)
lm-eval-harness/lm_eval/api/task.py:1093
↓ 7 callers
Function
get_wandb_logger
Safely get Weights&Biases logger from Trainer.
train/src/callbacks/wandb_callbacks.py:16
↓ 7 callers
Method
init
Hook called at end of __init__, override this instead of __init__
train/src/datamodules/base.py:194
↓ 7 callers
Method
model
(self)
lm-eval-harness/lm_eval/models/huggingface.py:359
↓ 7 callers
Method
print
(self)
synthetic/zoology/config.py:45
↓ 6 callers
Method
__init__
(self, dim: int, eps: float = 1e-6, elementwise_affine=True)
synthetic/zoology/mixers/gla.py:74
↓ 6 callers
Method
backward
(ctx, do)
based/models/triton/kernels/intra_chunk_contribution/fn_only_gv.py:269
↓ 6 callers
Method
backward
(ctx, dgk_cumsum, dk_reduce, dq_exp, dgk_last_exp)
based/models/triton/kernels/inter_chunk_contribution/preprocess_cumsum_gk.py:230
↓ 6 callers
Method
generate
r""" A streamlined generate() method overriding the transformers.GenerationMixin.generate() method. This method uses the same logits
lm-eval-harness/lm_eval/models/neuron_optimum.py:87
↓ 6 callers
Method
get_reordered
Gets the reordered array Returns: List[Any]: The reordered array
lm-eval-harness/lm_eval/utils.py:187
↓ 6 callers
Function
index_file_path
(prefix_path)
train/src/datamodules/datasets/indexed_dataset.py:120
↓ 6 callers
Method
state_dict
r"""Returns the state of the ExponentialMovingAverage as a dict.
train/src/utils/ema.py:216
↓ 6 callers
Method
tok_encode
(self, string: str)
lm-eval-harness/lm_eval/models/openai_completions.py:174
↓ 5 callers
Method
__init__
num_heads_kv: can be used to toggle MQA / GQA. If None, use num_heads. return_residual: whether to return the input x along with the
based/models/mixers/mha.py:379
↓ 5 callers
Method
_get_config
(self, name)
lm-eval-harness/lm_eval/tasks/__init__.py:111
↓ 5 callers
Method
_get_parameters
( self, parameters: Optional[Iterable[torch.nn.Parameter]] )
based/utils/ema.py:50
↓ 5 callers
Method
_get_parameters
( self, parameters: Optional[Iterable[torch.nn.Parameter]] )
train/src/utils/ema.py:50
↓ 5 callers
Function
_process_doc_prepended_question
(doc)
lm-eval-harness/lm_eval/tasks/scrolls/task.py:61
↓ 5 callers
Method
compute
(self)
train/src/metrics/num_tokens.py:30
↓ 5 callers
Method
doc_to_text
(self, doc)
lm-eval-harness/lm_eval/api/task.py:344
↓ 5 callers
Method
filter
(self, L, *args, **kwargs)
synthetic/zoology/mixers/hyena.py:187
↓ 5 callers
Method
finish
(self)
synthetic/zoology/logger.py:53
↓ 5 callers
Method
from_pretrained_hf
(cls, pretrained_model_name, device=None, dtype=None, **kwargs)
based/models/mamba.py:276
↓ 5 callers
Function
get_logger
Initializes multi-GPU-friendly python logger.
train/src/utils/utils.py:37
↓ 5 callers
Function
pad_and_concat
Method for padding a list of tensors given the maximum tensor length in the batch. Used for batching inputs and continuations in seq2seq
lm-eval-harness/lm_eval/models/utils.py:140
↓ 5 callers
Method
test_docs
:return: Iterable[obj] A iterable of any object, that doc_to_text can handle
lm-eval-harness/lm_eval/api/task.py:290
↓ 5 callers
Method
tok_encode
lm-eval-harness/lm_eval/models/neuron_optimum.py:343
↓ 5 callers
Method
tok_encode
lm-eval-harness/lm_eval/models/huggingface.py:674
↓ 5 callers
Method
validation_docs
:return: Iterable[obj] A iterable of any object, that doc_to_text can handle
lm-eval-harness/lm_eval/api/task.py:283
↓ 4 callers
Method
__init__
If process_group is not None, we're doing Tensor Parallel with sequence parallelism: we do an all_gather of x before doing the matmul
based/ops/fused_dense.py:532
↓ 4 callers
Method
__init__
(self, dim, w=10, train_freq=True)
synthetic/zoology/mixers/hyena.py:52
↓ 4 callers
Method
__init__
( self, d_model, d_output=None, mode="pool" )
train/src/tasks/decoders.py:146
↓ 4 callers
Method
__init__
(self, config: GPT2Config, process_group=None, device=None, dtype=None)
train/src/models/gpt.py:533
↓ 4 callers
Method
_data_loader
(self, dataset: Dataset, batch_size: int, shuffle: bool = False, sampler=None)
train/src/datamodules/t5_data.py:117
↓ 4 callers
Method
_data_loader
(self, dataset: Dataset, batch_size: int, shuffle: bool = False, sampler=None)
train/src/datamodules/language_modeling_neox.py:119
↓ 4 callers
Method
_name_is_registered
(self, name)
lm-eval-harness/lm_eval/tasks/__init__.py:72
↓ 4 callers
Function
combine_dim
(state_dicts, state_dict, key, dim=-1)
based/models/transformer/gpt.py:814
↓ 4 callers
Method
doc_to_text
(self, doc)
lm-eval-harness/lm_eval/api/task.py:1015
↓ 4 callers
Method
dtype
(self)
train/src/datamodules/datasets/indexed_dataset.py:454
↓ 4 callers
Method
expanded_size
(self)
synthetic/zoology/mixers/feature_maps/base.py:31
↓ 4 callers
Function
fft_conv
Args: u (torch.Tensor): Float tensor of shape (batch_size, d_model, seq_len) k (torch.Tensor): Float tensor of shape (d_model, l_
synthetic/zoology/mixers/listing.py:5
↓ 4 callers
Method
getCpuAffinity
(self)
based/utils/gpu_affinity.py:31
↓ 4 callers
Method
getCpuAffinity
(self)
train/src/utils/gpu_affinity.py:31
↓ 4 callers
Method
get_batched
Generates and yields batches from the reordered array. Parameters: - n (int): The size of each batch. Defaults to 1.
lm-eval-harness/lm_eval/models/utils.py:383
↓ 4 callers
Function
get_metric
(name: str, hf_evaluate_metric=False)
lm-eval-harness/lm_eval/api/registry.py:121
↓ 4 callers
Function
get_metric_aggregation
(name: str)
lm-eval-harness/lm_eval/api/registry.py:158
↓ 4 callers
Method
get_original
(self, grouped_dict)
lm-eval-harness/lm_eval/models/utils.py:118
↓ 4 callers
Method
get_original
Restores the original order of elements from the reordered list. Parameters: - newarr (List): The reordered array.
lm-eval-harness/lm_eval/models/utils.py:421
↓ 4 callers
Method
has_validation_docs
Whether the task has a validation set
lm-eval-harness/lm_eval/api/task.py:267
↓ 4 callers
Function
import_from_str
Imports a class or function from a string. Format: "module.submodule.ClassName" or "module.submodule.function_name". Args: pat
synthetic/zoology/utils.py:8
↓ 4 callers
Function
is_higher_better
(metric_name)
lm-eval-harness/lm_eval/api/registry.py:165
↓ 4 callers
Function
is_non_str_iterable
(obj)
lm-eval-harness/lm_eval/api/metrics.py:333
↓ 4 callers
Function
metric_max_over_ground_truths
Compute max metric between prediction and each ground truth.
lm-eval-harness/lm_eval/api/metrics.py:319
↓ 4 callers
Function
modify_logits_for_top_p_filtering
Set the logits for none top-p values to -inf. Done in-place.
based/generation.py:48
↓ 4 callers
Function
modify_logits_for_top_p_filtering
Set the logits for none top-p values to -inf. Done in-place.
train/src/generation.py:53
↓ 4 callers
Function
normalize_squad
Normalization used in official SQuAD evaluation script.
lm-eval-harness/lm_eval/tasks/super_glue/record/t5_utils.py:50
↓ 4 callers
Function
pooling
(x, pooling_mode='CLS', key_padding_mask=None, batch_first=True)
based/models/modules/seq_common.py:15
↓ 4 callers
Function
pooling
(x, pooling_mode='CLS', key_padding_mask=None, batch_first=True)
train/src/models/modules/seq_common.py:15
↓ 4 callers
Function
read_longs
(f, n)
train/src/datamodules/datasets/indexed_dataset.py:91
↓ 4 callers
Method
sample
Draw the first `n` samples in order from the specified split. Used for tasks with "canonical" ordered fewshot examples, such as MMLU
lm-eval-harness/lm_eval/api/samplers.py:75
↓ 4 callers
Method
setup
This method should set self.dataset_train, self.dataset_val, and self.dataset_test.
train/src/datamodules/base.py:198
↓ 4 callers
Function
shard_first_dim
(state_dict, key)
based/models/transformer/gpt.py:691
↓ 4 callers
Method
state_size
(self, sequence_length: int=2048)
synthetic/zoology/mixers/mamba.py:201
↓ 4 callers
Method
tok_encode
lm-eval-harness/lm_eval/models/vllm_causallms.py:146
↓ 4 callers
Function
write_longs
(f, a)
train/src/datamodules/datasets/indexed_dataset.py:97
↓ 3 callers
Method
__init__
(self, config: ModelConfig)
synthetic/zoology/model.py:159
↓ 3 callers
Method
__init__
Initializes the LongConvolution module. Args: d_model (int): The number of expected features in the input and output.
synthetic/zoology/mixers/convolution.py:116
↓ 3 callers
Method
__init__
(self, fullspace: bool = True, **kwargs)
synthetic/zoology/mixers/feature_maps/exp_dim.py:34
↓ 3 callers
Method
__init__
( self, in_features, hidden_features=None, out_features=None, activati
train/src/models/mlp.py:26
↓ 3 callers
Method
_collate
(cls, batch, *args, **kwargs)
train/src/datamodules/base.py:50
↓ 3 callers
Method
_collate_callback
Modify the behavior of the default _collate method.
train/src/datamodules/base.py:30
↓ 3 callers
Method
_data_loader
(self, dataset: Dataset, batch_size: int, shuffle: bool = False, sampler=None)
train/src/datamodules/language_modeling_hf.py:280
↓ 3 callers
Method
_detect_batch_size
(self, requests=None, pos: int = 0)
lm-eval-harness/lm_eval/models/huggingface.py:619
↓ 3 callers
Method
_eval_dataloader
(self, dataset, **kwargs)
train/src/datamodules/base.py:229
next →
1–100 of 1,739, ranked by callers