elizabethkunz commited on
Commit
f83bb36
1 Parent(s): 699fcaf

Upload subsets.py

Browse files
Files changed (1) hide show
  1. subsets.py +55 -0
subsets.py ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import json
3
+ import datasets
4
+ from datasets import load_dataset, Dataset, DatasetDict, Features, Value
5
+
6
+
7
+ class MyDatasetConfig(datasets.BuilderConfig):
8
+ def __init__(self, **kwargs):
9
+ super(MyDatasetConfig, self).__init__(**kwargs)
10
+ class MyDataset(datasets.GeneratorBasedBuilder):
11
+ BUILDER_CONFIGS = [
12
+ MyDatasetConfig(name="master_device-attributes", version=datasets.Version("1.0.0"), description="Master Device Attributes."),
13
+ ]
14
+
15
+ def _info(self):
16
+ return datasets.DatasetInfo(
17
+ features=datasets.Features({
18
+ "Qubit": datasets.Value("int32"),
19
+ "F_res_GHz": datasets.Value("string"),
20
+ "F_01_GHz": datasets.Value("string"),
21
+ "Alpha_2pi_MHz": datasets.Value("string"),
22
+ "Punchout_shift_MHz": datasets.Value("string"),
23
+ "Extracted_g_MHz": datasets.Value("string"),
24
+ "Estimated_Dispersive_Shift_KHz": datasets.Value("string"),
25
+ "L_j_nH": datasets.Value("string"),
26
+ "kappa": datasets.Value("string"),
27
+ "notes": datasets.Value("string")
28
+ }),
29
+ )
30
+
31
+
32
+
33
+ common_festures = Features({
34
+ "Qubit": Value("int32"),
35
+ "F_res_GHz": Value("string"),
36
+ "F_01_GHz": Value("string"),
37
+ "Alpha_2pi_MHz": Value("string"),
38
+ "Punchout_shift_MHz": Value("string"),
39
+ "Extracted_g_MHz": Value("string"),
40
+ "Estimated_Dispersive_Shift_KHz": Value("string"),
41
+ "L_j_nH": Value("string"),
42
+ "kappa": Value("string"),
43
+ "notes": Value("string")
44
+
45
+
46
+ })
47
+ json_file1 = Dataset.from_json(r'C:\Users\Liz\OneDrive\Documents\HuggingFace\SQuADDS_DB\master_device-attributes.json', features=features)
48
+
49
+ desired_order = ['design_code', 'contrib_info', 'measured_results', 'sim_results', 'notes']
50
+
51
+
52
+ json_file1 = json_file1.set_format(type=None, columns=desired_order)
53
+
54
+ # Save the DatasetDict to a new dataset on Hugging Face Hub
55
+ dataset_dict.push_to_hub("elizabethkunz/test_branch")