RECODE-H / annotations /annotation_20 /function_info.json
mcy98's picture
Upload folder using huggingface_hub
2d13eb2 verified
Raw History Blame Contribute Delete
7.9 kB
[
{
"function_name": "cal_grad_z",
"file_path": "code/prune/infulence_score.py",
"function_calls": [
{
"function_call_name": "trainer.get_sample_loss",
"functionality": "Returns the cross-entropy loss computed on one training sample by index.",
"input": "sample_idx",
"output": "loss (float tensor)",
"location_or_namespace": "code/prune/trainers.py"
},
{
"function_call_name": "trainer.model.named_parameters",
"functionality": "Yields parameter name and value tuples from the model.",
"input": "",
"output": "iterator over (name, parameter)",
"location_or_namespace": "code/prune/trainers.py"
},
{
"function_call_name": "grad",
"functionality": "Computes gradients of outputs with respect to inputs.",
"input": "loss, params",
"output": "list of gradients",
"location_or_namespace": "torch.autograd"
}
]
},
{
"function_name": "cal_grad_batch_z",
"file_path": "code/prune/infulence_score.py",
"function_calls": [
{
"function_call_name": "trainer.get_batch_loss",
"functionality": "Computes the average cross-entropy loss on a batch of training samples.",
"input": "batch",
"output": "loss (float tensor)",
"location_or_namespace": "code/prune/trainers.py"
},
{
"function_call_name": "trainer.model.named_parameters",
"functionality": "Yields parameter name and value tuples from the model.",
"input": "",
"output": "iterator over (name, parameter)",
"location_or_namespace": "code/prune/trainers.py"
},
{
"function_call_name": "grad",
"functionality": "Computes gradients of outputs with respect to inputs.",
"input": "loss, params",
"output": "list of gradients",
"location_or_namespace": "torch.autograd"
}
]
},
{
"function_name": "hvp",
"file_path": "code/prune/infulence_score.py",
"function_calls": [
{
"function_call_name": "grad",
"functionality": "Computes gradients of outputs with respect to inputs.",
"input": "y, w, retain_graph=True, create_graph=True",
"output": "first-order gradients",
"location_or_namespace": "torch.autograd"
},
{
"function_call_name": "zip",
"functionality": "Returns iterator of tuples from the argument iterables.",
"input": "first_grads, v",
"output": "iterator",
"location_or_namespace": "builtins"
},
{
"function_call_name": "torch.sum",
"functionality": "Sums all elements of the input tensor.",
"input": "grad_elem * v_elem",
"output": "scalar tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "grad",
"functionality": "Computes gradients of outputs with respect to inputs.",
"input": "elemwise_products, w, create_graph=True",
"output": "second-order gradient (HVP)",
"location_or_namespace": "torch.autograd"
}
]
},
{
"function_name": "estimate_hv",
"file_path": "code/prune/infulence_score.py",
"function_calls": [
{
"function_call_name": "tqdm",
"functionality": "Displays a progress bar for an iterable.",
"input": "range(recursion_depth), total=recursion_depth",
"output": "iterator with progress bar",
"location_or_namespace": "tqdm"
},
{
"function_call_name": "random.choice",
"functionality": "Selects a random element from a list.",
"input": "list of indices",
"output": "int",
"location_or_namespace": "random"
},
{
"function_call_name": "trainer.get_sample_loss",
"functionality": "Returns the cross-entropy loss computed on one training sample by index.",
"input": "random_idx",
"output": "loss (float tensor)",
"location_or_namespace": "code/prune/trainers.py"
},
{
"function_call_name": "trainer.model.named_parameters",
"functionality": "Yields parameter name and value tuples from the model.",
"input": "",
"output": "iterator over (name, parameter)",
"location_or_namespace": "code/prune/trainers.py"
},
{
"function_call_name": "hvp",
"functionality": "Computes Hessian-vector product using second-order autodiff.",
"input": "loss, params, h_estimate",
"output": "HVP result",
"location_or_namespace": "code/prune/infulence_score.py"
},
{
"function_call_name": "torch.no_grad",
"functionality": "Context manager to disable gradient tracking.",
"input": "with block",
"output": "",
"location_or_namespace": "torch"
},
{
"function_call_name": "_.detach",
"functionality": "Returns a tensor detached from the current graph.",
"input": "tensor",
"output": "detached tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "_.reshape",
"functionality": "Reshapes a tensor without changing its data.",
"input": "-1",
"output": "flattened tensor",
"location_or_namespace": "torch.Tensor"
}
]
},
{
"function_name": "get_influence_score",
"file_path": "code/prune/infulence_score.py",
"function_calls": [
{
"function_call_name": "cal_grad_batch_z",
"functionality": "Computes average batch loss gradients on validation set.",
"input": "batch, trainer",
"output": "gradient vector",
"location_or_namespace": "code/prune/infulence_score.py"
},
{
"function_call_name": "torch.cat",
"functionality": "Concatenates tensors along a dimension.",
"input": "v_list, dim=0",
"output": "concatenated tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "torch.mean",
"functionality": "Computes mean value of tensor along a dimension.",
"input": "tensor, dim=0",
"output": "mean tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "estimate_hv",
"functionality": "Recursively estimates H⁻¹·v using LiSSA algorithm.",
"input": "trainer, args, h_estimate, v",
"output": "H⁻¹v estimate",
"location_or_namespace": "code/prune/infulence_score.py"
},
{
"function_call_name": "cal_grad_z",
"functionality": "Computes per-sample loss gradient with respect to model parameters.",
"input": "idx, trainer",
"output": "gradient vector",
"location_or_namespace": "code/prune/infulence_score.py"
},
{
"function_call_name": "torch.matmul",
"functionality": "Performs matrix multiplication on input tensors.",
"input": "H_inverse[0], sample[0].view(-1).T",
"output": "scalar",
"location_or_namespace": "torch"
},
{
"function_call_name": "torch.tensor",
"functionality": "Creates a tensor from a list or array.",
"input": "influence_score",
"output": "tensor object",
"location_or_namespace": "torch"
},
{
"function_call_name": "tensor.cpu",
"functionality": "Moves tensor to CPU memory.",
"input": "",
"output": "tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "tqdm",
"functionality": "Displays progress bar for iterable.",
"input": "range(len(trainer.train_dataset)), total=...",
"output": "iterator with progress bar",
"location_or_namespace": "tqdm"
}
]
}
]