test commit
Browse files- testdata.py +34 -0
testdata.py
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import mlcroissant as mlc
|
2 |
+
import pandas as pd
|
3 |
+
import os
|
4 |
+
|
5 |
+
# These values are used by mlcroissant
|
6 |
+
# to perform the necessary auth to fetch the data
|
7 |
+
# Provide your Kaggle username and API key
|
8 |
+
os.environ['CROISSANT_BASIC_AUTH_USERNAME'] = 'enzetao'
|
9 |
+
os.environ['CROISSANT_BASIC_AUTH_PASSWORD'] = "a97ddf556baf4db4723d78aab014b599"
|
10 |
+
|
11 |
+
|
12 |
+
# Fetch the Croissant JSON-LD
|
13 |
+
# croissant_dataset = mlc.Dataset('https://www.kaggle.com/datasets/yueyin27/refref/croissant/download')
|
14 |
+
# croissant_dataset = mlc.Dataset('https://www.kaggle.com/datasets/nguyenhung1903/nerf-synthetic-dataset/croissant/download')
|
15 |
+
# croissant_dataset = mlc.Dataset('https://www.kaggle.com/datasets/enzetao/refref/croissant/download')
|
16 |
+
# croissant_dataset = mlc.Dataset('https://www.kaggle.com/datasets/muratkokludataset/rice-image-dataset/croissant/download')
|
17 |
+
url = 'https://huggingface.co/api/datasets/fashion_mnist/croissant'
|
18 |
+
|
19 |
+
print(mlc.Dataset(url).metadata.to_json())
|
20 |
+
import tensorflow_datasets as tfds
|
21 |
+
builder = tfds.core.dataset_builders.CroissantBuilder(
|
22 |
+
jsonld=url,
|
23 |
+
record_set_ids=["fashion_mnist"],
|
24 |
+
file_format='array_record',
|
25 |
+
)
|
26 |
+
builder.download_and_prepare()
|
27 |
+
|
28 |
+
# # Check what record sets are in the dataset
|
29 |
+
# record_sets = croissant_dataset.metadata.record_sets
|
30 |
+
# print(record_sets)
|
31 |
+
|
32 |
+
# # Fetch the records and put them in a DataFrame
|
33 |
+
# record_set_df = pd.DataFrame(croissant_dataset.records(record_set=record_sets[0].uuid))
|
34 |
+
# record_set_df.head()
|