llmtuner.store
Storing information on datasets and workflows in local database
Classes
Small DB to hold data sets and processing info for model development |
Functions
|
Module Contents
- class llmtuner.store.LLMTunerStore(filename='llmtuner.db', datapath='local', keepopen=False)[source]
Small DB to hold data sets and processing info for model development
- static _query_create_table_from_schema(schema, table_name='')[source]
Extract table name and properties
- static format_data_to_sql(schema, data)[source]
Reformat the entries of the dictionary ‘data’ according to the JSON schema ‘schema’ to fit into SQL tables. Arrays and objects are converted to JSON strings, and booleans are converted to integers.
- Parameters:
schema (dict): The JSON schema defining the structure and types of ‘data’. data (dict): The data dictionary to be formatted.
- Returns:
dict: A new dictionary with the values reformatted according to the schema.
- get_table_metadata(table_name)[source]
Get information for table ‘table_name’. Returns dictionary with column names, column info and number of rows.
- add_data_to_table(table_name, data_dict, uniquekeys=[], update=False, mergekeys=[])[source]
Add data from dictionary to a table in sqlite connection. If ‘uniquekey’ is provided, the entry is only added if not another entry with the same value for the key is present in the table. If ‘update’ is True, an existing entry is updated.