kernelfoundry.algorithm.utils.kernelbench_dataset¶
Functions
|
Assign a unique hash to a problem in the dataset |
|
Fill the KernelBench template with the given reference and config and other info, copy to tmpdir |
|
Assign a unique hash to some piece of code Important to strip out the comments and whitespace as they are not functionally part of the code |
|
|
|
Construct task_set from configuration |
|
Get ID of KernelBench task from database |
|
|
|
Get dictionary of available tasks for robust-kbench. |
Load functionals csv if not yet in memory |
|
Convert KernelBench task for Task object |
|
|
Load KernelBench task either from database or csv file, return as string or as customTask :param config: config with job parameters :param task_name: name of the operation :type task_name: str :param from_db: if True, load from db (otherwise load from csv) :type from_db: bool :param as_custom_task: whether to return :type as_custom_task: bool :param origin: task_origin if fetching from database (supported: {KernelBench, robust_kbench}) :type origin: str |
|
Load KernelBench task from the pytorch functionals csv :param task_name: The name of the operation to get from the DB :type task_name: str :param config: config parameters |
|
Load KernelBench task from the Tasks table in the database :param task_name: The name of the operation to get from the DB :type task_name: str :param config: config to initialize the database :param origin: task_origin (supported: {KernelBench, robust_kbench}) :type origin: str |
- kernelfoundry.algorithm.utils.kernelbench_dataset.init_pytorch_functionals()[source]¶
Load functionals csv if not yet in memory
- kernelfoundry.algorithm.utils.kernelbench_dataset.load_kernelbench_task_from_csv(task_name: str, config: DictConfig) str[source]¶
Load KernelBench task from the pytorch functionals csv :param task_name: The name of the operation to get from the DB :type task_name: str :param config: config parameters
- Returns:
reference code
- Return type:
- kernelfoundry.algorithm.utils.kernelbench_dataset.load_kernelbench_task_from_db(task_name: str, config: DictConfig, origin: str = 'KernelBench') str[source]¶
Load KernelBench task from the Tasks table in the database :param task_name: The name of the operation to get from the DB :type task_name: str :param config: config to initialize the database :param origin: task_origin (supported: {KernelBench, robust_kbench}) :type origin: str
- Returns:
reference code
- Return type:
- kernelfoundry.algorithm.utils.kernelbench_dataset.create_custom_task_files(tmpdir: str, config: DictConfig, task_name: str, reference: str, level: int)[source]¶
Fill the KernelBench template with the given reference and config and other info, copy to tmpdir
- kernelfoundry.algorithm.utils.kernelbench_dataset.kernelbench_reference_to_custom_task(task_name: str, config: DictConfig, reference: str, level: int) Task[source]¶
Convert KernelBench task for Task object
- kernelfoundry.algorithm.utils.kernelbench_dataset.load_kernelbench_task(config: DictConfig, task_name: str, from_db: bool = False, as_custom_task: bool = False, origin: str = 'KernelBench')[source]¶
Load KernelBench task either from database or csv file, return as string or as customTask :param config: config with job parameters :param task_name: name of the operation :type task_name: str :param from_db: if True, load from db (otherwise load from csv) :type from_db: bool :param as_custom_task: whether to return :type as_custom_task: bool :param origin: task_origin if fetching from database (supported: {KernelBench, robust_kbench}) :type origin: str
- Returns:
task as str or Task
- kernelfoundry.algorithm.utils.kernelbench_dataset.get_kernelbench_task_id(task_name: str)[source]¶
Get ID of KernelBench task from database
- kernelfoundry.algorithm.utils.kernelbench_dataset.assign_problem_hash(problem_path: str) list[int][source]¶
Assign a unique hash to a problem in the dataset
- kernelfoundry.algorithm.utils.kernelbench_dataset.get_code_hash(problem_src: str) str[source]¶
Assign a unique hash to some piece of code Important to strip out the comments and whitespace as they are not functionally part of the code
- kernelfoundry.algorithm.utils.kernelbench_dataset.get_kernelbench_subset(data_config)[source]¶
Construct task_set from configuration
- kernelfoundry.algorithm.utils.kernelbench_dataset.get_robust_kbench_task_list(config: DictConfig) dict[source]¶
Get dictionary of available tasks for robust-kbench. :param config: general configuration (for db init)
- Returns:
Dictionary of {Op_ID: task_name} with all tasks with origin robust_kbench
- Return type: