{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Load Dataset\n", "Examples for loading datasets with configs and split" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/media/ppak/Storage/HuggingFace/NIST-In-Situ-IN625-LPBF-Overhangs/venv/lib/python3.12/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", " from .autonotebook import tqdm as notebook_tqdm\n" ] } ], "source": [ "from datasets import load_dataset, get_dataset_config_names, get_dataset_split_names" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "ppak10/NIST-In-Situ-IN625-LPBF-Overhangs None None None None None None {'trust_remote_code': True}\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "Repo card metadata block was not found. Setting CardData to empty.\n" ] }, { "data": { "text/plain": [ "['base', 'block', 'overhang_no_supports', 'overhang_with_supports']" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "get_dataset_split_names(\n", " \"ppak10/NIST-In-Situ-IN625-LPBF-Overhangs\",\n", " trust_remote_code=True\n", ")" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "Repo card metadata block was not found. Setting CardData to empty.\n" ] } ], "source": [ "ds = load_dataset(\n", " \"ppak10/NIST-In-Situ-IN625-LPBF-Overhangs\",\n", " \"layer_table\"\n", " split=\"base\",\n", " streaming=True,\n", " trust_remote_code=True\n", ")" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "IterableDataset({\n", " features: ['folder_layer_range', 'part', 'part_section', 'process', 'source', 'layer_number', 'build_time', 'contact_email', 'file_name', 'hatch_spacing', 'laser_power', 'layer_thickness', 'material', 'radiant_temp', 's_hvariable__a', 's_hvariable__b', 's_hvariable__c', 'scan_speed', 'website'],\n", " n_shards: 98\n", "})\n", "{'folder_layer_range': Value(dtype='string', id=None), 'part': Value(dtype='string', id=None), 'part_section': Value(dtype='string', id=None), 'process': Value(dtype='string', id=None), 'source': Value(dtype='string', id=None), 'layer_number': Value(dtype='string', id=None), 'build_time': Sequence(feature=Sequence(feature=Value(dtype='float32', id=None), length=-1, id=None), length=-1, id=None), 'contact_email': Value(dtype='string', id=None), 'file_name': Value(dtype='string', id=None), 'hatch_spacing': Value(dtype='uint32', id=None), 'laser_power': Value(dtype='uint32', id=None), 'layer_thickness': Value(dtype='uint32', id=None), 'material': Value(dtype='string', id=None), 'radiant_temp': Sequence(feature=Sequence(feature=Sequence(feature=Value(dtype='uint32', id=None), length=-1, id=None), length=-1, id=None), length=-1, id=None), 's_hvariable__a': Value(dtype='float32', id=None), 's_hvariable__b': Value(dtype='float32', id=None), 's_hvariable__c': Value(dtype='float32', id=None), 'scan_speed': Value(dtype='uint32', id=None), 'website': Value(dtype='string', id=None)}\n" ] } ], "source": [ "print(ds)\n", "print(ds.features)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "IterableDataset({\n", " features: ['folder_layer_range', 'part', 'part_section', 'process', 'source', 'layer_number', 'build_time', 'contact_email', 'file_name', 'hatch_spacing', 'laser_power', 'layer_thickness', 'material', 'radiant_temp', 's_hvariable__a', 's_hvariable__b', 's_hvariable__c', 'scan_speed', 'website'],\n", " n_shards: 98\n", "})\n", "\n" ] } ], "source": [ "import torch\n", "torch_ds = ds.with_format(\"torch\")\n", "print(torch_ds)\n", "print(type(torch_ds.with_format(\"torch\"))) #it passes\n", "loader = torch.utils.data.DataLoader(torch_ds, batch_size = 1)" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0\n", "1\n", "2\n", "3\n" ] } ], "source": [ "for i, row in enumerate(loader):\n", " print(i)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "ename": "KeyboardInterrupt", "evalue": "", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", "Cell \u001b[0;32mIn[7], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;43;01mfor\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mdata\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01min\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mds\u001b[49m\u001b[43m:\u001b[49m\n\u001b[1;32m 2\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mprint\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mdata\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mlayer_number\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 3\u001b[0m \u001b[38;5;66;03m# for key, value in data.items():\u001b[39;00m\n\u001b[1;32m 4\u001b[0m \u001b[38;5;66;03m# print(key, np.array(value).shape)\u001b[39;00m\n", "File \u001b[0;32m/media/ppak/Storage/HuggingFace/NIST-In-Situ-IN625-LPBF-Overhangs/venv/lib/python3.12/site-packages/datasets/iterable_dataset.py:1393\u001b[0m, in \u001b[0;36mIterableDataset.__iter__\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 1389\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m key, example \u001b[38;5;129;01min\u001b[39;00m ex_iterable:\n\u001b[1;32m 1390\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mfeatures:\n\u001b[1;32m 1391\u001b[0m \u001b[38;5;66;03m# `IterableDataset` automatically fills missing columns with None.\u001b[39;00m\n\u001b[1;32m 1392\u001b[0m \u001b[38;5;66;03m# This is done with `_apply_feature_types_on_example`.\u001b[39;00m\n\u001b[0;32m-> 1393\u001b[0m example \u001b[38;5;241m=\u001b[39m \u001b[43m_apply_feature_types_on_example\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1394\u001b[0m \u001b[43m \u001b[49m\u001b[43mexample\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfeatures\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtoken_per_repo_id\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_token_per_repo_id\u001b[49m\n\u001b[1;32m 1395\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1396\u001b[0m \u001b[38;5;28;01myield\u001b[39;00m format_dict(example) \u001b[38;5;28;01mif\u001b[39;00m format_dict \u001b[38;5;28;01melse\u001b[39;00m example\n", "File \u001b[0;32m/media/ppak/Storage/HuggingFace/NIST-In-Situ-IN625-LPBF-Overhangs/venv/lib/python3.12/site-packages/datasets/iterable_dataset.py:1080\u001b[0m, in \u001b[0;36m_apply_feature_types_on_example\u001b[0;34m(example, features, token_per_repo_id)\u001b[0m\n\u001b[1;32m 1078\u001b[0m example[column_name] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 1079\u001b[0m \u001b[38;5;66;03m# we encode the example for ClassLabel feature types for example\u001b[39;00m\n\u001b[0;32m-> 1080\u001b[0m encoded_example \u001b[38;5;241m=\u001b[39m \u001b[43mfeatures\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mencode_example\u001b[49m\u001b[43m(\u001b[49m\u001b[43mexample\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1081\u001b[0m \u001b[38;5;66;03m# Decode example for Audio feature, e.g.\u001b[39;00m\n\u001b[1;32m 1082\u001b[0m decoded_example \u001b[38;5;241m=\u001b[39m features\u001b[38;5;241m.\u001b[39mdecode_example(encoded_example, token_per_repo_id\u001b[38;5;241m=\u001b[39mtoken_per_repo_id)\n", "File \u001b[0;32m/media/ppak/Storage/HuggingFace/NIST-In-Situ-IN625-LPBF-Overhangs/venv/lib/python3.12/site-packages/datasets/features/features.py:1924\u001b[0m, in \u001b[0;36mFeatures.encode_example\u001b[0;34m(self, example)\u001b[0m\n\u001b[1;32m 1913\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 1914\u001b[0m \u001b[38;5;124;03mEncode example into a format for Arrow.\u001b[39;00m\n\u001b[1;32m 1915\u001b[0m \n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 1921\u001b[0m \u001b[38;5;124;03m `dict[str, Any]`\u001b[39;00m\n\u001b[1;32m 1922\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 1923\u001b[0m example \u001b[38;5;241m=\u001b[39m cast_to_python_objects(example)\n\u001b[0;32m-> 1924\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mencode_nested_example\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mexample\u001b[49m\u001b[43m)\u001b[49m\n", "File \u001b[0;32m/media/ppak/Storage/HuggingFace/NIST-In-Situ-IN625-LPBF-Overhangs/venv/lib/python3.12/site-packages/datasets/features/features.py:1244\u001b[0m, in \u001b[0;36mencode_nested_example\u001b[0;34m(schema, obj, level)\u001b[0m\n\u001b[1;32m 1241\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m level \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m0\u001b[39m \u001b[38;5;129;01mand\u001b[39;00m obj \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 1242\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mGot None but expected a dictionary instead\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 1243\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m (\n\u001b[0;32m-> 1244\u001b[0m {k: \u001b[43mencode_nested_example\u001b[49m\u001b[43m(\u001b[49m\u001b[43mschema\u001b[49m\u001b[43m[\u001b[49m\u001b[43mk\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mobj\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[43mk\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mlevel\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mlevel\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m+\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;241;43m1\u001b[39;49m\u001b[43m)\u001b[49m \u001b[38;5;28;01mfor\u001b[39;00m k \u001b[38;5;129;01min\u001b[39;00m schema}\n\u001b[1;32m 1245\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m obj \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 1246\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 1247\u001b[0m )\n\u001b[1;32m 1249\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(schema, (\u001b[38;5;28mlist\u001b[39m, \u001b[38;5;28mtuple\u001b[39m)):\n\u001b[1;32m 1250\u001b[0m sub_schema \u001b[38;5;241m=\u001b[39m schema[\u001b[38;5;241m0\u001b[39m]\n", "File \u001b[0;32m/media/ppak/Storage/HuggingFace/NIST-In-Situ-IN625-LPBF-Overhangs/venv/lib/python3.12/site-packages/datasets/features/features.py:1295\u001b[0m, in \u001b[0;36mencode_nested_example\u001b[0;34m(schema, obj, level)\u001b[0m\n\u001b[1;32m 1290\u001b[0m \u001b[38;5;66;03m# be careful when comparing tensors here\u001b[39;00m\n\u001b[1;32m 1291\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m (\n\u001b[1;32m 1292\u001b[0m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(first_elmt, \u001b[38;5;28mlist\u001b[39m)\n\u001b[1;32m 1293\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m encode_nested_example(schema\u001b[38;5;241m.\u001b[39mfeature, first_elmt, level\u001b[38;5;241m=\u001b[39mlevel \u001b[38;5;241m+\u001b[39m \u001b[38;5;241m1\u001b[39m) \u001b[38;5;241m!=\u001b[39m first_elmt\n\u001b[1;32m 1294\u001b[0m ):\n\u001b[0;32m-> 1295\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m [\u001b[43mencode_nested_example\u001b[49m\u001b[43m(\u001b[49m\u001b[43mschema\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfeature\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mo\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mlevel\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mlevel\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m+\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;241;43m1\u001b[39;49m\u001b[43m)\u001b[49m \u001b[38;5;28;01mfor\u001b[39;00m o \u001b[38;5;129;01min\u001b[39;00m obj]\n\u001b[1;32m 1296\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mlist\u001b[39m(obj)\n\u001b[1;32m 1297\u001b[0m \u001b[38;5;66;03m# Object with special encoding:\u001b[39;00m\n\u001b[1;32m 1298\u001b[0m \u001b[38;5;66;03m# ClassLabel will convert from string to int, TranslationVariableLanguages does some checks\u001b[39;00m\n", "File \u001b[0;32m/media/ppak/Storage/HuggingFace/NIST-In-Situ-IN625-LPBF-Overhangs/venv/lib/python3.12/site-packages/datasets/features/features.py:1295\u001b[0m, in \u001b[0;36mencode_nested_example\u001b[0;34m(schema, obj, level)\u001b[0m\n\u001b[1;32m 1290\u001b[0m \u001b[38;5;66;03m# be careful when comparing tensors here\u001b[39;00m\n\u001b[1;32m 1291\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m (\n\u001b[1;32m 1292\u001b[0m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(first_elmt, \u001b[38;5;28mlist\u001b[39m)\n\u001b[1;32m 1293\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m encode_nested_example(schema\u001b[38;5;241m.\u001b[39mfeature, first_elmt, level\u001b[38;5;241m=\u001b[39mlevel \u001b[38;5;241m+\u001b[39m \u001b[38;5;241m1\u001b[39m) \u001b[38;5;241m!=\u001b[39m first_elmt\n\u001b[1;32m 1294\u001b[0m ):\n\u001b[0;32m-> 1295\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m [\u001b[43mencode_nested_example\u001b[49m\u001b[43m(\u001b[49m\u001b[43mschema\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfeature\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mo\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mlevel\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mlevel\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m+\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;241;43m1\u001b[39;49m\u001b[43m)\u001b[49m \u001b[38;5;28;01mfor\u001b[39;00m o \u001b[38;5;129;01min\u001b[39;00m obj]\n\u001b[1;32m 1296\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mlist\u001b[39m(obj)\n\u001b[1;32m 1297\u001b[0m \u001b[38;5;66;03m# Object with special encoding:\u001b[39;00m\n\u001b[1;32m 1298\u001b[0m \u001b[38;5;66;03m# ClassLabel will convert from string to int, TranslationVariableLanguages does some checks\u001b[39;00m\n", "File \u001b[0;32m/media/ppak/Storage/HuggingFace/NIST-In-Situ-IN625-LPBF-Overhangs/venv/lib/python3.12/site-packages/datasets/features/features.py:1295\u001b[0m, in \u001b[0;36mencode_nested_example\u001b[0;34m(schema, obj, level)\u001b[0m\n\u001b[1;32m 1290\u001b[0m \u001b[38;5;66;03m# be careful when comparing tensors here\u001b[39;00m\n\u001b[1;32m 1291\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m (\n\u001b[1;32m 1292\u001b[0m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(first_elmt, \u001b[38;5;28mlist\u001b[39m)\n\u001b[1;32m 1293\u001b[0m \u001b[38;5;129;01mor\u001b[39;00m encode_nested_example(schema\u001b[38;5;241m.\u001b[39mfeature, first_elmt, level\u001b[38;5;241m=\u001b[39mlevel \u001b[38;5;241m+\u001b[39m \u001b[38;5;241m1\u001b[39m) \u001b[38;5;241m!=\u001b[39m first_elmt\n\u001b[1;32m 1294\u001b[0m ):\n\u001b[0;32m-> 1295\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m [\u001b[43mencode_nested_example\u001b[49m\u001b[43m(\u001b[49m\u001b[43mschema\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfeature\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mo\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mlevel\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mlevel\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m+\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;241;43m1\u001b[39;49m\u001b[43m)\u001b[49m \u001b[38;5;28;01mfor\u001b[39;00m o \u001b[38;5;129;01min\u001b[39;00m obj]\n\u001b[1;32m 1296\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mlist\u001b[39m(obj)\n\u001b[1;32m 1297\u001b[0m \u001b[38;5;66;03m# Object with special encoding:\u001b[39;00m\n\u001b[1;32m 1298\u001b[0m \u001b[38;5;66;03m# ClassLabel will convert from string to int, TranslationVariableLanguages does some checks\u001b[39;00m\n", "File \u001b[0;32m/media/ppak/Storage/HuggingFace/NIST-In-Situ-IN625-LPBF-Overhangs/venv/lib/python3.12/site-packages/datasets/features/features.py:1300\u001b[0m, in \u001b[0;36mencode_nested_example\u001b[0;34m(schema, obj, level)\u001b[0m\n\u001b[1;32m 1297\u001b[0m \u001b[38;5;66;03m# Object with special encoding:\u001b[39;00m\n\u001b[1;32m 1298\u001b[0m \u001b[38;5;66;03m# ClassLabel will convert from string to int, TranslationVariableLanguages does some checks\u001b[39;00m\n\u001b[1;32m 1299\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(schema, (Audio, Image, ClassLabel, TranslationVariableLanguages, Value, _ArrayXD)):\n\u001b[0;32m-> 1300\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mschema\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mencode_example\u001b[49m\u001b[43m(\u001b[49m\u001b[43mobj\u001b[49m\u001b[43m)\u001b[49m \u001b[38;5;28;01mif\u001b[39;00m obj \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 1301\u001b[0m \u001b[38;5;66;03m# Other object should be directly convertible to a native Arrow type (like Translation and Translation)\u001b[39;00m\n\u001b[1;32m 1302\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m obj\n", "File \u001b[0;32m/media/ppak/Storage/HuggingFace/NIST-In-Situ-IN625-LPBF-Overhangs/venv/lib/python3.12/site-packages/datasets/features/features.py:515\u001b[0m, in \u001b[0;36mValue.encode_example\u001b[0;34m(self, value)\u001b[0m\n\u001b[1;32m 513\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mbool\u001b[39m(value)\n\u001b[1;32m 514\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m pa\u001b[38;5;241m.\u001b[39mtypes\u001b[38;5;241m.\u001b[39mis_integer(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mpa_type):\n\u001b[0;32m--> 515\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mint\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mvalue\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 516\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m pa\u001b[38;5;241m.\u001b[39mtypes\u001b[38;5;241m.\u001b[39mis_floating(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mpa_type):\n\u001b[1;32m 517\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mfloat\u001b[39m(value)\n", "\u001b[0;31mKeyboardInterrupt\u001b[0m: " ] } ], "source": [ "for data in ds:\n", " print(data[\"layer_number\"])\n", "# for key, value in data.items():\n", "# print(key, np.array(value).shape)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "venv", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.3" } }, "nbformat": 4, "nbformat_minor": 2 }