RECODE-H / annotations /annotation_47 /function_info.json
mcy98's picture
Upload folder using huggingface_hub
22e9602 verified
Raw History Blame Contribute Delete
17.6 kB
[
{
"function_name": "LoraModel.__init__",
"file_path": "peft/lora.py",
"function_calls": [
{
"function_call_name": "super().__init__",
"functionality": "Initializes the parent torch.nn.Module.",
"input": "self",
"output": "None",
"location_or_namespace": "torch.nn.Module"
},
{
"function_call_name": "self._find_and_replace",
"functionality": "Finds and replaces target modules with LoRA layers.",
"input": "self",
"output": "None",
"location_or_namespace": "peft/lora.py"
},
{
"function_call_name": "mark_only_lora_as_trainable",
"functionality": "Sets the requires_grad flag for model parameters, freezing non-LoRA layers.",
"input": "model (torch.nn.Module), bias (str)",
"output": "None",
"location_or_namespace": "peft/lora.py"
}
]
},
{
"function_name": "LoraModel._find_and_replace",
"file_path": "peft/lora.py",
"function_calls": [
{
"function_call_name": "getattr",
"functionality": "Returns the value of a named attribute of an object.",
"input": "object, name (str), default (any)",
"output": "any",
"location_or_namespace": "builtins"
},
{
"function_call_name": "hasattr",
"functionality": "Returns true if the object has the given named attribute and false if it does not.",
"input": "object, name (str)",
"output": "bool",
"location_or_namespace": "builtins"
},
{
"function_call_name": "re.fullmatch",
"functionality": "Checks if the entire string matches the regular expression pattern.",
"input": "pattern (str), string (str)",
"output": "match object or None",
"location_or_namespace": "re"
},
{
"function_call_name": "self._get_submodules",
"functionality": "Retrieves the parent module, target module, and target name for a given key.",
"input": "self, key (str)",
"output": "tuple (parent_module, target_module, target_name)",
"location_or_namespace": "peft/lora.py"
},
{
"function_call_name": "isinstance",
"functionality": "Checks if an object is an instance of a class or of a subclass thereof.",
"input": "object, classinfo",
"output": "bool",
"location_or_namespace": "builtins"
},
{
"function_call_name": "Linear",
"functionality": "Constructor for the custom LoRA linear layer.",
"input": "in_features (int), out_features (int), bias (bool), **kwargs",
"output": "Linear object",
"location_or_namespace": "peft/lora.py"
},
{
"function_call_name": "self._replace_module",
"functionality": "Replaces a module in the model with a new module.",
"input": "self, parent_module (torch.nn.Module), child_name (str), new_module (torch.nn.Module), old_module (torch.nn.Module)",
"output": "None",
"location_or_namespace": "peft/lora.py"
}
]
},
{
"function_name": "LoraModel._get_submodules",
"file_path": "peft/lora.py",
"function_calls": [
{
"function_call_name": "self.model.get_submodule",
"functionality": "Returns the submodule given by the dot-separated path.",
"input": "target (str)",
"output": "torch.nn.Module",
"location_or_namespace": "torch.nn.Module"
}
]
},
{
"function_name": "LoraModel._replace_module",
"file_path": "peft/lora.py",
"function_calls": [
{
"function_call_name": "setattr",
"functionality": "Sets the value of an attribute of an object.",
"input": "object, name (str), value (any)",
"output": "None",
"location_or_namespace": "builtins"
},
{
"function_call_name": "getattr",
"functionality": "Returns the value of a named attribute of an object.",
"input": "object, name (str), default (any)",
"output": "any",
"location_or_namespace": "builtins"
},
{
"function_call_name": "new_module.named_modules",
"functionality": "Returns an iterator over all modules in the network, yielding both the name of the module as well as the module itself.",
"input": "self",
"output": "iterator",
"location_or_namespace": "torch.nn.Module"
},
{
"function_call_name": "module.to",
"functionality": "Moves and/or casts the parameters and buffers.",
"input": "device (torch.device)",
"output": "self",
"location_or_namespace": "torch.nn.Module"
}
]
},
{
"function_name": "LoraModel.get_peft_config_as_dict",
"file_path": "peft/lora.py",
"function_calls": [
{
"function_call_name": "asdict",
"functionality": "Return a new dict which maps field names to their values for a dataclass instance.",
"input": "obj",
"output": "dict",
"location_or_namespace": "dataclasses"
},
{
"function_call_name": "isinstance",
"functionality": "Checks if an object is an instance of a class or of a subclass thereof.",
"input": "object, classinfo",
"output": "bool",
"location_or_namespace": "builtins"
}
]
},
{
"function_name": "LoraModel.enable_adapter_layers",
"file_path": "peft/lora.py",
"function_calls": [
{
"function_call_name": "self._set_adapter_layers",
"functionality": "Internal helper to enable or disable adapter layers.",
"input": "self, enabled (bool)",
"output": "None",
"location_or_namespace": "peft/lora.py"
}
]
},
{
"function_name": "LoraModel.disable_adapter_layers",
"file_path": "peft/lora.py",
"function_calls": [
{
"function_call_name": "self._set_adapter_layers",
"functionality": "Internal helper to enable or disable adapter layers.",
"input": "self, enabled (bool)",
"output": "None",
"location_or_namespace": "peft/lora.py"
}
]
},
{
"function_name": "mark_only_lora_as_trainable",
"file_path": "peft/lora.py",
"function_calls": [
{
"function_call_name": "model.named_parameters",
"functionality": "Returns an iterator over module parameters, yielding both the name of the parameter as well as the parameter itself.",
"input": "self",
"output": "iterator",
"location_or_namespace": "torch.nn.Module"
},
{
"function_call_name": "model.modules",
"functionality": "Returns an iterator over all modules in the network.",
"input": "self",
"output": "iterator",
"location_or_namespace": "torch.nn.Module"
},
{
"function_call_name": "isinstance",
"functionality": "Checks if an object is an instance of a class or of a subclass thereof.",
"input": "object, classinfo",
"output": "bool",
"location_or_namespace": "builtins"
},
{
"function_call_name": "hasattr",
"functionality": "Returns true if the object has the given named attribute and false if it does not.",
"input": "object, name (str)",
"output": "bool",
"location_or_namespace": "builtins"
}
]
},
{
"function_name": "LoraLayer.__init__",
"file_path": "peft/lora.py",
"function_calls": [
{
"function_call_name": "torch.nn.Dropout",
"functionality": "Initializes a dropout layer.",
"input": "p (float)",
"output": "Dropout layer object",
"location_or_namespace": "torch.nn"
}
]
},
{
"function_name": "Linear.__init__",
"file_path": "peft/lora.py",
"function_calls": [
{
"function_call_name": "torch.nn.Linear.__init__",
"functionality": "Initializes the parent nn.Linear layer.",
"input": "self, in_features (int), out_features (int), **kwargs",
"output": "None",
"location_or_namespace": "torch.nn"
},
{
"function_call_name": "LoraLayer.__init__",
"functionality": "Initializes the LoraLayer base class.",
"input": "self, r (int), lora_alpha (int), lora_dropout (float), merge_weights (bool)",
"output": "None",
"location_or_namespace": "peft/lora.py"
},
{
"function_call_name": "torch.nn.Linear",
"functionality": "Initializes a standard linear layer.",
"input": "in_features (int), out_features (int), bias (bool)",
"output": "Linear layer object",
"location_or_namespace": "torch.nn"
},
{
"function_call_name": "setattr",
"functionality": "Sets the value of an attribute of an object.",
"input": "object, name (str), value (any)",
"output": "None",
"location_or_namespace": "builtins"
},
{
"function_call_name": "self.reset_parameters",
"functionality": "Initializes the weights of the LoRA and base layers.",
"input": "self",
"output": "None",
"location_or_namespace": "peft/lora.py"
}
]
},
{
"function_name": "Linear.reset_parameters",
"file_path": "peft/lora.py",
"function_calls": [
{
"function_call_name": "torch.nn.Linear.reset_parameters",
"functionality": "Resets the parameters of the base linear layer.",
"input": "self",
"output": "None",
"location_or_namespace": "torch.nn"
},
{
"function_call_name": "hasattr",
"functionality": "Returns true if the object has the given named attribute and false if it does not.",
"input": "object, name (str)",
"output": "bool",
"location_or_namespace": "builtins"
},
{
"function_call_name": "getattr",
"functionality": "Returns the value of a named attribute of an object.",
"input": "object, name (str)",
"output": "any",
"location_or_namespace": "builtins"
},
{
"function_call_name": "torch.nn.init.kaiming_uniform_",
"functionality": "Fills the input Tensor with values according to the Kaiming uniform distribution.",
"input": "tensor, a (float)",
"output": "Tensor",
"location_or_namespace": "torch.nn.init"
},
{
"function_call_name": "torch.nn.init.zeros_",
"functionality": "Fills the input Tensor with the scalar value 0.",
"input": "tensor",
"output": "Tensor",
"location_or_namespace": "torch.nn.init"
},
{
"function_call_name": "math.sqrt",
"functionality": "Returns the square root of a number.",
"input": "x (number)",
"output": "float",
"location_or_namespace": "math"
}
]
},
{
"function_name": "Linear.train",
"file_path": "peft/lora.py",
"function_calls": [
{
"function_call_name": "torch.nn.Linear.train",
"functionality": "Sets the module in training mode.",
"input": "self, mode (bool)",
"output": "self",
"location_or_namespace": "torch.nn"
},
{
"function_call_name": "lora_route.train",
"functionality": "Sets the routing layer in training mode.",
"input": "mode (bool)",
"output": "self",
"location_or_namespace": "torch.nn.Module"
},
{
"function_call_name": "getattr",
"functionality": "Returns the value of a named attribute of an object.",
"input": "object, name (str)",
"output": "any",
"location_or_namespace": "builtins"
}
]
},
{
"function_name": "Linear.eval",
"file_path": "peft/lora.py",
"function_calls": [
{
"function_call_name": "torch.nn.Linear.eval",
"functionality": "Sets the module in evaluation mode.",
"input": "self",
"output": "self",
"location_or_namespace": "torch.nn"
},
{
"function_call_name": "lora_route.eval",
"functionality": "Sets the routing layer in evaluation mode.",
"input": "self",
"output": "self",
"location_or_namespace": "torch.nn.Module"
},
{
"function_call_name": "getattr",
"functionality": "Returns the value of a named attribute of an object.",
"input": "object, name (str)",
"output": "any",
"location_or_namespace": "builtins"
}
]
},
{
"function_name": "Linear.cv_squared",
"file_path": "peft/lora.py",
"function_calls": [
{
"function_call_name": "torch.tensor",
"functionality": "Constructs a tensor with data.",
"input": "data, device, dtype",
"output": "Tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "x.float",
"functionality": "Casts the tensor to float dtype.",
"input": "self",
"output": "Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "x.var",
"functionality": "Calculates the variance of the tensor.",
"input": "self",
"output": "Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "x.mean",
"functionality": "Calculates the mean of the tensor.",
"input": "self",
"output": "Tensor",
"location_or_namespace": "torch.Tensor"
}
]
},
{
"function_name": "Linear.forward",
"file_path": "peft/lora.py",
"function_calls": [
{
"function_call_name": "torch.nn.functional.linear",
"functionality": "Applies a linear transformation to the incoming data.",
"input": "input, weight, bias",
"output": "Tensor",
"location_or_namespace": "torch.nn.functional"
},
{
"function_call_name": "transpose",
"functionality": "Transposes a matrix.",
"input": "x (Tensor), fan_in_fan_out (bool)",
"output": "Tensor",
"location_or_namespace": "peft.utils"
},
{
"function_call_name": "torch.nn.functional.softmax",
"functionality": "Applies a softmax function.",
"input": "input, dim, dtype",
"output": "Tensor",
"location_or_namespace": "torch.nn.functional"
},
{
"function_call_name": "self.lora_route",
"functionality": "Forward pass of the routing linear layer.",
"input": "x (Tensor)",
"output": "Tensor",
"location_or_namespace": "torch.nn.Module"
},
{
"function_call_name": "torch.unsqueeze",
"functionality": "Returns a new tensor with a dimension of size one inserted at the specified position.",
"input": "input, dim",
"output": "Tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "getattr",
"functionality": "Returns the value of a named attribute of an object.",
"input": "object, name (str)",
"output": "any",
"location_or_namespace": "builtins"
},
{
"function_call_name": "self.lora_dropout",
"functionality": "Forward pass of the dropout layer.",
"input": "x (Tensor)",
"output": "Tensor",
"location_or_namespace": "torch.nn.Dropout"
},
{
"function_call_name": "torch.zeros",
"functionality": "Returns a tensor filled with the scalar value 0.",
"input": "size, device",
"output": "Tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "task_types.view",
"functionality": "Returns a new tensor with the same data as the self tensor but of a different shape.",
"input": "shape",
"output": "Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "self.cv_squared",
"functionality": "Calculates the squared coefficient of variation.",
"input": "self, x (Tensor)",
"output": "Tensor",
"location_or_namespace": "peft/lora.py"
},
{
"function_call_name": "route_weight.sum",
"functionality": "Calculates the sum of tensor elements over given dimensions.",
"input": "dim",
"output": "Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "torch.where",
"functionality": "Return a tensor of elements selected from either x or y, depending on condition.",
"input": "condition, x, y",
"output": "Tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "torch.concat",
"functionality": "Concatenates the given sequence of seq tensors in the given dimension.",
"input": "tensors, dim",
"output": "Tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "tensor.repeat",
"functionality": "Repeats this tensor along the specified dimensions.",
"input": "sizes",
"output": "Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "tensor.flatten",
"functionality": "Flattens a contiguous range of dims in a tensor.",
"input": "self",
"output": "Tensor",
"location_or_namespace": "torch.Tensor"
}
]
}
]