MCPcopy Create free account

hub / github.com/CERT-Lab/lora-sb / functions

Functions134 in github.com/CERT-Lab/lora-sb

↓ 5 callersFunctiontranspose
(weight, fan_in_fan_out)
utils/latent_utils.py:6
↓ 4 callersFunctionformat_params
Format parameter count in terms of K (1000)
utils/misc.py:5
↓ 4 callersMethodget_backward_hook
(pre=True)
utils/offload_utils_for_quant/forward_backward_offload.py:191
↓ 4 callersFunctionkaiming_uniform_init
(matrix: torch.tensor)
utils/initialization_utils.py:73
↓ 4 callersFunctionmath_equal
Exact match of math if and only if: 1. numerical equal: both can convert to float and are equal 2. symbolic equal: both can convert to sy
instruction_tuning_eval/grader.py:22
↓ 4 callersFunctionreplace_module_weights
(target_module, new_weight)
utils/initialization_utils.py:47
↓ 3 callersFunctioncount_parameters
Count total, classifier, and non-classifier trainable parameters in a PyTorch model. Returns values in terms of K (1000) parameters.
utils/misc.py:11
↓ 3 callersFunctionestimate_and_process_grads_torch
Estimates and processes gradients using batch-wise computation. Returns a dictionary of processed gradients. Args: model: Th
utils/gradient_utils.py:36
↓ 3 callersFunctionfind_and_initialize_grad
:param adapter_name: options: 'default' :param reconstr_type: options: 'svd'
utils/initialization_utils.py:79
↓ 3 callersFunctioninit_module_weights
(target_module: torch.nn.Linear, sigma: float)
utils/initialization_utils.py:38
↓ 3 callersFunctionshow_gpu_and_cpu_memory
()
utils/offload_utils_for_quant/resource_monitor.py:28
↓ 2 callersFunction_parse
(s)
instruction_tuning_eval/grader.py:103
↓ 2 callersFunctioncreate_dataloader
(dataset, args, shuffle=True)
utils/data_utils.py:149
↓ 2 callersFunctioncreate_model_tokenizer_it
(args)
models.py:71
↓ 2 callersFunctiongenerate_prompt_cr
Generate prompt from data point.
utils/data_utils.py:257
↓ 2 callersMethodget_backward_hook_by_block
(info: dict, pre=True, device="cuda")
utils/offload_utils_for_quant/forward_backward_offload.py:165
↓ 2 callersMethodget_forward_hook
device is executing device origin_device is the device where tensor is saved after forward
utils/offload_utils_for_quant/forward_hook.py:49
↓ 2 callersMethodget_forward_hook_by_block
(info: dict, pre=True, device="cuda", with_kwargs=True)
utils/offload_utils_for_quant/forward_backward_offload.py:117
↓ 2 callersFunctionget_svd_grad
Use PyTorch's SVD which can utilize GPU acceleration
utils/svd_utils.py:4
↓ 2 callersFunctionis_classifier_layer
Check if the layer is part of classifier based on common naming patterns
utils/misc.py:23
↓ 2 callersFunctionis_digit
(s)
instruction_tuning_eval/grader.py:14
↓ 2 callersFunctionis_number
(s)
instruction_tuning_eval/gsm8k_eval.py:17
↓ 2 callersFunctionkaiming_uniform_init_lower_half
(matrix: torch.tensor)
utils/initialization_utils.py:68
↓ 2 callersFunctionstrip_string
(string)
instruction_tuning_eval/utils.py:172
↓ 2 callersFunctionsymbolic_equal
(a, b)
instruction_tuning_eval/grader.py:102
↓ 2 callersFunctiontokenize_cr
Tokenize the prompt.
utils/data_utils.py:279
↓ 1 callersFunction_clean_numbers
Clean Numbers in the given string >>> _clean_numbers(None, "Hello 123") 'Hello 123' >>> _clean_numbers(None, "Hello 1234") 'Hell
instruction_tuning_eval/utils.py:67
↓ 1 callersFunction_tokenize_fn
Tokenize a list of strings.
utils/data_utils.py:172
↓ 1 callersFunctionbatch_data
(data_list, batch_size=1)
instruction_tuning_eval/gsm8k_eval.py:61
↓ 1 callersFunctionbatch_data
Split data into batches.
instruction_tuning_eval/commonsense_eval.py:34
↓ 1 callersFunctionbatch_data
(data_list, batch_size=1)
instruction_tuning_eval/MATH_eval.py:48
↓ 1 callersFunctioncalculate_metrics
(all_true_labels, all_predictions, task)
train_eval.py:60
↓ 1 callersFunctioncall_with_timeout
(func, *args, timeout=1, **kwargs)
instruction_tuning_eval/grader.py:133
↓ 1 callersFunctioncommonsense_test
Main evaluation function for commonsense tasks.
instruction_tuning_eval/commonsense_eval.py:72
↓ 1 callersFunctioncreate_model_tokenizer
(num_labels, args)
models.py:30
↓ 1 callersFunctioncreate_peft_model
(model, args)
models.py:42
↓ 1 callersFunctioncreate_peft_model_cr
(model, args)
models.py:148
↓ 1 callersFunctioncreate_peft_model_it
(model, args)
models.py:132
↓ 1 callersFunctioncreate_run_directory
Create a directory structure for the current training run.
train_cr.py:35
↓ 1 callersFunctioncreate_run_directory
Create a directory structure for the current training run.
train_arithmetic.py:35
↓ 1 callersFunctionevaluate_glue
(model, dataloader, args, max_metric1, max_metric2)
train_eval.py:86
↓ 1 callersFunctionextract_answer
Extract the answer from model output based on dataset type.
instruction_tuning_eval/commonsense_eval.py:14
↓ 1 callersFunctionextract_answer_number
(completion)
instruction_tuning_eval/gsm8k_eval.py:32
↓ 1 callersFunctionfind_and_initialize
:param adapter_name: options: 'default' :param reconstr_type: options: 'svd'
utils/initialization_utils.py:155
↓ 1 callersFunctionfinetune
()
train_cr.py:64
↓ 1 callersFunctionfinetune
(task)
train_glue.py:65
↓ 1 callersFunctionfinetune
()
train_arithmetic.py:64
↓ 1 callersFunctionfix_a_slash_b
(string)
instruction_tuning_eval/utils.py:132
↓ 1 callersFunctionfix_fracs
(string)
instruction_tuning_eval/utils.py:100
↓ 1 callersFunctionfix_sqrt
(string)
instruction_tuning_eval/utils.py:157
↓ 1 callersFunctiongenerate_and_tokenize_prompt_cr
Generate and tokenize prompt with proper labels.
utils/data_utils.py:305
↓ 1 callersFunctiongenerate_prompt
Generate prompt in the standard format.
instruction_tuning_eval/commonsense_eval.py:49
↓ 1 callersMethodget_align_device_pre_forward_hook
ensure same device for input and module
utils/offload_utils_for_quant/forward_hook.py:9
↓ 1 callersMethodget_module_list
Get the module name list of the leaf nodes of the module tree, and stop recursing when the specified node(no_split_module_class) is
utils/offload_utils_for_quant/forward_hook.py:117
↓ 1 callersMethodget_partition_block
(module_list: list, num_block: int)
utils/offload_utils_for_quant/forward_backward_offload.py:246
↓ 1 callersFunctionget_record_gradient_hook
Creates a hook to record the gradients of a model's parameters into a dictionary. Args: model (torch.nn.Module): The model whose gra
utils/gradient_utils.py:14
↓ 1 callersMethodget_record_gradient_hook
(self, model, record_dict)
utils/offload_utils_for_quant/gradient_offload.py:45
↓ 1 callersFunctionget_replacement_module
(weight, module_name, type, writer, reconstruct_config, init_scaling=1)
utils/initialization_utils.py:15
↓ 1 callersFunctionget_replacement_module_grad
(weight, type, reconstruct_config)
utils/initialization_utils.py:25
↓ 1 callersFunctionget_split_num
Calculates the ratio of original type size to quantized type size. Args: origin_type (str, optional): The data type of the original
utils/offload_utils_for_quant/split.py:22
↓ 1 callersFunctiongsm8k_test
(model, data_path, start=0, end=MAX_INT, batch_size=1, tensor_parallel_size=1)
instruction_tuning_eval/gsm8k_eval.py:75
↓ 1 callersFunctionlast_boxed_only_string
(string)
instruction_tuning_eval/utils.py:13
↓ 1 callersFunctionload_and_preprocess_cr
Load and preprocess the dataset.
utils/data_utils.py:238
↓ 1 callersFunctionload_and_preprocess_data
(task, tokenizer, args)
utils/data_utils.py:27
↓ 1 callersFunctionload_and_preprocess_it
(tokenizer, args)
utils/data_utils.py:215
↓ 1 callersFunctionmerge_xs
(args)
utils/merge_adapter_to_base_model.py:13
↓ 1 callersFunctionoffload_condition
The offload conditions are: the tensor is on cuda, and the number of bytes occupied by the tensor is equal to the theoretical number of b
utils/offload_utils_for_quant/graph_hook.py:4
↓ 1 callersFunctionparse_args
()
instruction_tuning_eval/gsm8k_eval.py:160
↓ 1 callersFunctionparse_args
()
instruction_tuning_eval/commonsense_eval.py:147
↓ 1 callersFunctionparse_args
()
instruction_tuning_eval/MATH_eval.py:120
↓ 1 callersFunctionpreprocess
Preprocess the data by tokenizing.
utils/data_utils.py:195
↓ 1 callersFunctionprint_cpu_memory
()
utils/offload_utils_for_quant/resource_monitor.py:6
↓ 1 callersFunctionprint_gpu_memory
()
utils/offload_utils_for_quant/resource_monitor.py:21
↓ 1 callersFunctionprocess_results
(doc, completion, answer)
instruction_tuning_eval/MATH_eval.py:27
↓ 1 callersMethodregister_forward_hook_by_module
(self, module: torch.nn.Module, parent_name="")
utils/offload_utils_for_quant/forward_backward_offload.py:213
↓ 1 callersMethodregister_gradient_hook
(self)
utils/offload_utils_for_quant/gradient_offload.py:38
↓ 1 callersMethodregister_hook_by_block
(self, module: torch.nn.Module, parent_name="")
utils/offload_utils_for_quant/forward_backward_offload.py:81
↓ 1 callersFunctionremove_boxed
(s)
instruction_tuning_eval/MATH_eval.py:17
↓ 1 callersFunctionremove_right_units
(string)
instruction_tuning_eval/utils.py:147
↓ 1 callersFunctiontest_hendrycks_math
(model, data_path, start=0, end=MAX_INT, batch_size=1, tensor_parallel_size=1)
instruction_tuning_eval/MATH_eval.py:62
Method__call__
(self, instances: Sequence[Dict])
utils/data_utils.py:158
Method__enter__
(self)
utils/offload_utils_for_quant/context.py:55
Method__enter__
(self)
utils/offload_utils_for_quant/saved_tensor_offload.py:12
Method__enter__
Register the hook in the appropriate module
utils/offload_utils_for_quant/forward_backward_offload.py:57
Method__enter__
(self)
utils/offload_utils_for_quant/model_offload.py:43
Method__enter__
(self)
utils/offload_utils_for_quant/gradient_offload.py:31
Method__eq__
(self, other)
instruction_tuning_eval/utils.py:260
Method__exit__
(self, exc_type, exc_val, exc_tb)
utils/offload_utils_for_quant/context.py:59
Method__exit__
(self, exc_type, exc_val, exc_tb)
utils/offload_utils_for_quant/saved_tensor_offload.py:15
Method__exit__
remove hook registered by __enter__
utils/offload_utils_for_quant/forward_backward_offload.py:70
Method__exit__
(self, exc_type, exc_val, exc_tb)
utils/offload_utils_for_quant/model_offload.py:50
Method__exit__
(self, exc_type, exc_val, exc_tb)
utils/offload_utils_for_quant/gradient_offload.py:34
Method__init__
Offload part of model to cpu. Args: model (torch.nn.Module): Model to be offloaded named_grads (dict): Contains the n
utils/offload_utils_for_quant/context.py:9
Method__init__
(self)
utils/offload_utils_for_quant/forward_hook.py:5
Method__init__
(self)
utils/offload_utils_for_quant/saved_tensor_offload.py:6
Method__init__
Offload model during forward and backward. Args: model (torch.nn.Module): The model to which the hook will be applied.
utils/offload_utils_for_quant/forward_backward_offload.py:10
Method__init__
Initializes the ModelOffloadHookContext to manage offloading of model computations and saved tensors. Args: model (torch
utils/offload_utils_for_quant/model_offload.py:6
Method__init__
Offload gradient to cpu Args: model (torch.nn.Module): The model whose gradients will be offloaded. record_dict (dict
utils/offload_utils_for_quant/gradient_offload.py:5
Method_get_full_name_list
get full name list of all submodule. result is self.
utils/offload_utils_for_quant/forward_hook.py:101
Method_get_module_list
(module: torch.nn.Module, parent_name="")
utils/offload_utils_for_quant/forward_hook.py:124
next →1–100 of 134, ranked by callers