MCPcopy Create free account

hub / github.com/Vahe1994/AQLM / functions

Functions225 in github.com/Vahe1994/AQLM

↓ 12 callersFunctioncheck_use_bfloat16
inference_lib/src/aqlm/inference_kernels/cuda_kernel.cpp:9
↓ 7 callersFunction_dequantize_weight
Decode float weights from quantization codes. Differentiable. :param codes: tensor of integer quantization codes, shape [*dims, num_out_group
src/utils.py:65
↓ 7 callersFunctionget_layers
(model)
src/modelutils.py:140
↓ 7 callersFunctionget_model
( model_path, load_quantized=None, dtype="auto", device_map=None, attn_implementation=None, trust_remote_c
src/modelutils.py:48
↓ 7 callersMethodload_state_dict
(self, state_dict: StateDict)
src/pv_optimizer.py:436
↓ 6 callersMethodbackward
(ctx, grad_output: torch.Tensor)
inference_lib/src/aqlm/inference.py:126
↓ 6 callersFunctionscale_bias_unflatten_output
inference_lib/src/aqlm/inference_kernels/cuda_kernel.cpp:95
↓ 6 callersMethodstate_dict
(self)
src/pv_optimizer.py:426
↓ 4 callersFunctionprint_runtime_stats
(operation_name: str, enabled: bool = True, device: Optional[torch.device] = None)
src/pv_utils.py:121
↓ 4 callersFunctionupdate_outs
Update outs_tensor with new activations and optionally compute sample-wise mse loss with previous activations :param layer: transformer layer
main.py:526
↓ 4 callersFunctionupdate_outs_parallel
Parallel version of update_outs_and_compute_losses; works on lists of input/output tensors
main.py:556
↓ 3 callersFunction_compute_mse_on_batch
Compute the activation MSE error between transformer layers :param
src/finetune.py:249
↓ 3 callersFunction_compute_mse_parallel
Compute MSE in parallel over multiple GPUs, each GPU processes a portion of samples
src/finetune.py:273
↓ 3 callersFunction_compute_size
(qw: QuantizedWeight)
src/pv_utils.py:159
↓ 3 callersMethodestimate_nbits_per_parameter
Calculate the effective number of bits per original matrix parameters
src/aq.py:256
↓ 3 callersFunctionfit_kmeans_1d
optimized batch k-means for 1d datapoint using sort :param groupwise_data: stuff to be compressed, shape: [num_groups, group_size] :param
src/kmeans.py:189
↓ 3 callersMethodget_codebooks
Get quantization codebooks or reconstruct them from second level quantization (see codebook_values_nbits)
src/aq.py:142
↓ 3 callersMethodget_codes
Get a non view to codes, regardless of how codes are stored
src/aq.py:118
↓ 3 callersFunctionget_forward_pass_kernel
( codebooks: torch.Tensor, optimize_for_training: bool, )
inference_lib/src/aqlm/inference_kernels/kernel_selector.py:21
↓ 3 callersFunctionget_inps
mocks model launch to collect inputs to the first model layer :returns: a list of torch tensors with activations for each device in args.devi
main.py:65
↓ 3 callersFunctionget_loaders
Loads and prepares data for a Transformers model. Args: name (str): The name of the dataset to load. This can be one of 'wiki
src/datautils.py:177
↓ 3 callersFunctioninfer_module_classes
find transformer block classes that should be wrapped with inner FullyShardedDataParallel (auto_wrap_policy)
src/pv_utils.py:18
↓ 3 callersFunctionis_signed
Return True iff an integer dtype is signed
src/utils.py:213
↓ 3 callersMethoditerate_local_quantized_weights
Iterate over (name, QuantizedWeight) pairs for all quantized weights trained by this optimizer and rank
src/pv_optimizer.py:420
↓ 3 callersFunctionreplace_parameter_
A hacky way to substitute an already registered parameter with a non-parameter tensor. Breaks future use.
aq_engine.py:211
↓ 3 callersMethodstep
(self, *args, **kwargs)
src/pv_optimizer.py:213
↓ 3 callersFunctionunpack_int_data
(data: torch.IntTensor, nbits: int)
inference_lib/src/aqlm/utils.py:30
↓ 3 callersMethodzero_grad
(self, set_to_none: bool = True, *args, **kwargs)
src/pv_optimizer.py:411
↓ 2 callersFunction_aggregate_tensors_by_name
:param sharded_tensors_by_name: a dictionary from string to flat (1d) tensors available on the current shard :note: the keys should be the sa
src/pv_optimizer.py:463
↓ 2 callersMethod_compute_mse
Compute the activation MSE error = ||X @ quantized_weight - X @ reference_weight||^2 Use the square-of-difference formula to avoid ma
aq_engine.py:108
↓ 2 callersFunction_fetch_state_to_device
(state, device)
src/configurable_adam.py:233
↓ 2 callersFunction_get_autograd_matmul_op
(forward_pass_kernel, backward_pass_kernel)
inference_lib/src/aqlm/inference.py:99
↓ 2 callersFunction_groupwise_find_border_indices
(clusters, sorted_data)
src/kmeans.py:233
↓ 2 callersFunction_groupwise_squared_norms
Given a matrix delta [out_features, in_features], compute a tensor [num_output_groups, num_input_groups] that contains the squared su
src/beam_search_l2.py:108
↓ 2 callersFunction_make_range
(n: int)
src/beam_search_xtx.py:88
↓ 2 callersMethod_maybe_init_state
(self, param: torch.Tensor, group: dict)
src/configurable_adam.py:66
↓ 2 callersFunction_update_flat_codes
update _flat_codes [num_groups, num_codebooks] to approximate _flat_reference [num_groups, group_size]
src/beam_search_l2.py:86
↓ 2 callersFunctionaqlm_gemv_lut
(x, codebooks, codes_alt, scales)
benchmark/matmul_benchmark_cpu.py:101
↓ 2 callersMethodbeam_search_update_codes_
Update quantized_weight codes in-place via beam search
aq_engine.py:171
↓ 2 callersFunctionbenchmark
(f, warmup=10, iter=10)
benchmark/matmul_benchmark.py:11
↓ 2 callersFunctionbenchmark
(f, warmup=10, iter=10)
benchmark/matmul_benchmark_cpu.py:17
↓ 2 callersFunctioncompute_kl_divergence_loss_values
Compute token-wise KL divergence loss without materializing all logits/logprobs simultaneously :param student_hidden_states: input hidden sta
src/memory_efficient_loss.py:15
↓ 2 callersFunctionfind_sublayers
(module, layers=(nn.Conv2d, nn.Linear))
src/modelutils.py:151
↓ 2 callersFunctionget_backward_pass_kernel
( codebooks: torch.Tensor, optimize_for_training: bool, )
inference_lib/src/aqlm/inference_kernels/kernel_selector.py:105
↓ 2 callersFunctionget_int_dtype
(nbits: int)
inference_lib/src/aqlm/utils.py:11
↓ 2 callersFunctionget_model_head_with_norm
(model)
src/modelutils.py:96
↓ 2 callersMethodget_scales
Get per-channel or per-group quantization scales or reconstruct those scales based on scales_nbits
src/aq.py:180
↓ 2 callersFunctionis_tokenized
(dataset)
finetune.py:483
↓ 2 callersFunctioniterate_minibatches
Samples data points *forever*, in random order, with less overhead than DataLoader; Adapted from https://github.com/stanis-morozov/unq/blob/m
src/utils.py:105
↓ 2 callersFunctionload_quantized_model_with_old_pickle
Hacky way to allow compatibility between old *pickled* layers and new transformers
convert_legacy_model_format.py:20
↓ 2 callersFunctionpack_int_data
(data: torch.IntTensor, nbits: int)
inference_lib/src/aqlm/utils.py:24
↓ 2 callersFunctionsave_not_quantized_weights
(model: nn.Module, save_dir: str)
src/modelutils.py:268
↓ 2 callersFunctionsave_training_state
Save model, optimizer state dict and training metadata to be loaded via load_training_state
finetune.py:816
↓ 2 callersMethodset_codes
Update codes[selection] to new_codes, regardless of their dtype and whether they are wrapped as storage
src/aq.py:126
↓ 2 callersFunctionwrap_model_with_fsdp_
Wrap a model *ForCausalLM components: transformer and lm_head are wrapped as FSDP instances
finetune.py:666
↓ 1 callersMethod__init__
(self, module)
main.py:124
↓ 1 callersMethod__init__
(self, quantized_weight: QuantizedWeight, bias: Optional[nn.Parameter])
src/aq.py:19
↓ 1 callersMethod_aggregate_dequantized_weights
collect full (possibly optimizer-updated) dequantized weights
src/pv_optimizer.py:255
↓ 1 callersMethod_aggregate_gradients_for_dequantized_weights
collect full parameter gradients from fsdp-sharded parameters, return dict[name -> grad]
src/pv_optimizer.py:224
↓ 1 callersFunction_beam_search_select_best
Select top-:beam_size: and reorder beam accordingly, return new beam :param beam_codes: a tensor with best weight codes, shape: [beam_size, n
src/beam_search_xtx.py:288
↓ 1 callersFunction_beam_search_squared_errors
Compute MSE or sum-of-squared-error losses for all possible ways to replace quantization codes for one input group and one codebook. Works i
src/beam_search_xtx.py:146
↓ 1 callersFunction_beam_search_update_codes_groupwise
:param reference: [num_groups, group_size] :param codes: [num_groups, num_codebooks] :param codebooks: [num_codebooks, codebook_size, gro
src/beam_search_l2.py:169
↓ 1 callersFunction_channelwise_squared_error
Compute per-channel squared error between X @ weight_or_weights and X @ reference_weight :param XTX: pairwise products of input features matm
src/beam_search_xtx.py:349
↓ 1 callersFunction_commit_state_updates
(offloaded_states, fetched_states)
src/configurable_adam.py:239
↓ 1 callersMethod_compute_mse_parallel
Compute MSE in parallel over output channels
aq_engine.py:139
↓ 1 callersFunction_dequantize_weight
Decode float weights from quantization codes. Differentiable. :param codes: tensor of integer quantization codes, shape [*dims, num_out_group
inference_lib/src/aqlm/utils.py:44
↓ 1 callersMethod_forward
(self, input: torch.Tensor)
src/aq.py:26
↓ 1 callersFunction_get_flat_param_groups
(param_groups)
src/configurable_adam.py:229
↓ 1 callersFunction_get_sharded_param_sizes_by_rank
For each parameter name, return a tuple of sizes (numbers of elements) this parameter across all FSDP ranks
src/pv_optimizer.py:449
↓ 1 callersFunction_greedy_find_best_codes
:param reference: [num_groups, group_size] :param codebook: [codebook_size, group_size] :param chunk_size_values: how many values can be
src/beam_search_l2.py:273
↓ 1 callersFunction_inner_adam_step_and_update_statistics
( p: torch.Tensor, grad: torch.Tensor, exp_avg: torch.Tensor, exp_avg_sq: torch.Tensor, v_
src/configurable_adam.py:191
↓ 1 callersFunction_kmeans_greedy_init
Get initial clusters by iteratively choosing a vector that is the farthest from already selected clusters
src/kmeans.py:10
↓ 1 callersFunction_make_parameter_replacement_tables
Prepare auxiliary data structures for quickly copying parameters to replicas for data-parallel training.
src/finetune.py:213
↓ 1 callersMethod_optimize_quantized_weights
Update discrete state representations to approximate straight through buffers
src/pv_optimizer.py:309
↓ 1 callersMethod_propagate_grads_to_optimized_parameters
Ensure that every optimized parameter receives gradient
src/pv_optimizer.py:275
↓ 1 callersMethod_select_optimized_parameters
Choose which version of parameter to optimize: the parameter itself or a straight-through buffer
src/pv_optimizer.py:146
↓ 1 callersMethod_update_dequantized_weights
Assign dequantized weight buffers to latest quantized weights after codebook/scale/code updates
src/pv_optimizer.py:379
↓ 1 callersMethodadd_batch
Accumulate a minibatch of layer inputs and update the X.T @ X (aka half hessian)
aq_engine.py:31
↓ 1 callersFunctionadd_data_args
(parser: argparse.ArgumentParser)
finetune.py:385
↓ 1 callersFunctionadd_finetuning_args
(parser: argparse.ArgumentParser)
finetune.py:141
↓ 1 callersFunctionadd_model_args
(parser: argparse.ArgumentParser)
finetune.py:52
↓ 1 callersFunctionaqlm_gemm_stupid
( input: torch.Tensor, codes_i16: torch.ShortTensor, codebooks: torch.Tensor, scales: torch.Te
inference_lib/src/aqlm/inference_kernels/triton_kernel.py:132
↓ 1 callersMethodbeam_search_update_codes_
Update own codes in-place via beam search so as to minimize squared errors. Return the updated codes. :param reference_weight: origin
src/aq.py:213
↓ 1 callersFunctioncli_evaluate
(args: Union[argparse.Namespace, None] = None)
lmeval.py:150
↓ 1 callersFunctioncode1x16_matvec
inference_lib/src/aqlm/inference_kernels/cuda_kernel.cpp:113
↓ 1 callersFunctioncode1x8_matvec
inference_lib/src/aqlm/inference_kernels/cuda_kernel.cpp:521
↓ 1 callersFunctioncode2x8_matvec
inference_lib/src/aqlm/inference_kernels/cuda_kernel.cpp:356
↓ 1 callersFunctioncompute_loss_on_batch
( batch: dict, teacher_model: FullyShardedDataParallel, student_model: FullyShardedDataParallel,
finetune.py:937
↓ 1 callersFunctioncompute_validation_perplexities
(args: argparse.Namespace, model: nn.Module, eval_datasets: dict)
finetune.py:975
↓ 1 callersFunctioncreate_dequantized_model
Create a version of the model where all QuanizedWeight and derivative layers are de-quantized and cast to dtype. :param model: model to be de
src/pv_utils.py:31
↓ 1 callersFunctioncreate_p_optimizer
Create optimizer for training only continuous parameters of a quantized model
finetune.py:771
↓ 1 callersFunctioncreate_pv_optimizer
Create optimizer for PV-Tuning using a de-quantized student model and a dictionary of quantized weights
finetune.py:701
↓ 1 callersFunctiondispatch_quantized_model
(model)
src/modelutils.py:33
↓ 1 callersFunctionevaluate_perplexity
Perplexity evaluation as per https://github.com/IST-DASLab/gptq (standard among quantization research)
src/datautils.py:288
↓ 1 callersFunctionfind_nearest_cluster
Find nearest clusters for each batch of data and return their indices
src/kmeans.py:163
↓ 1 callersFunctionfinetune_groupwise
Fine-tune a module with pre-quantized linear layers so as to minimize MSE between layer-wise inps/outs :param layer: a trainable module wher
src/finetune.py:20
↓ 1 callersFunctionfit_faiss_kmeans
:param data: [nsamples, dim] :param k: number of centroids :param max_iter: run at most this many iterations :param gpu: if True, run
src/kmeans.py:120
↓ 1 callersFunctionfit_kmeans
:param data: [nsamples, dim] :param k: number of centroids :param max_iter: run at most this many iterations :param check_every: chec
src/kmeans.py:24
↓ 1 callersMethodforward
(self)
src/utils.py:173
↓ 1 callersFunctionget_c4
(nsamples, seqlen, tokenizer, eval_mode=False)
src/datautils.py:77
next →1–100 of 225, ranked by callers