import json import datasets from datasets import load_dataset, Dataset, DatasetDict, Features, Value class MyDatasetConfig(datasets.BuilderConfig): def __init__(self, **kwargs): super(MyDatasetConfig, self).__init__(**kwargs) class MyDataset(datasets.GeneratorBasedBuilder): BUILDER_CONFIGS = [ MyDatasetConfig(name="master_device-attributes", version=datasets.Version("1.0.0"), description="Master Device Attributes."), ] def _info(self): return datasets.DatasetInfo( features=datasets.Features({ "Qubit": datasets.Value("int32"), "F_res_GHz": datasets.Value("string"), "F_01_GHz": datasets.Value("string"), "Alpha_2pi_MHz": datasets.Value("string"), "Punchout_shift_MHz": datasets.Value("string"), "Extracted_g_MHz": datasets.Value("string"), "Estimated_Dispersive_Shift_KHz": datasets.Value("string"), "L_j_nH": datasets.Value("string"), "kappa": datasets.Value("string"), "notes": datasets.Value("string") }), ) common_festures = Features({ "Qubit": Value("int32"), "F_res_GHz": Value("string"), "F_01_GHz": Value("string"), "Alpha_2pi_MHz": Value("string"), "Punchout_shift_MHz": Value("string"), "Extracted_g_MHz": Value("string"), "Estimated_Dispersive_Shift_KHz": Value("string"), "L_j_nH": Value("string"), "kappa": Value("string"), "notes": Value("string") }) json_file1 = Dataset.from_json(r'C:\Users\Liz\OneDrive\Documents\HuggingFace\SQuADDS_DB\master_device-attributes.json', features=features) desired_order = ['design_code', 'contrib_info', 'measured_results', 'sim_results', 'notes'] json_file1 = json_file1.set_format(type=None, columns=desired_order) # Save the DatasetDict to a new dataset on Hugging Face Hub dataset_dict.push_to_hub("elizabethkunz/test_branch")