Sadjad Alikhani commited on
Commit
2daf081
·
verified ·
1 Parent(s): 5d9b43b

Delete dataset_script.py

Browse files
Files changed (1) hide show
  1. dataset_script.py +0 -51
dataset_script.py DELETED
@@ -1,51 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- """
3
- Created on Sun Sep 15 16:51:53 2024
4
-
5
- @author: salikha4
6
- """
7
-
8
- import os
9
- import pickle
10
- import datasets
11
-
12
- class MyDataset(datasets.GeneratorBasedBuilder):
13
- def _info(self):
14
- # Dataset metadata and features
15
- return datasets.DatasetInfo(
16
- description="Dataset with a pickled .p file loaded from a zip.",
17
- features=datasets.Features({
18
- "data": datasets.Value("string"), # Placeholder feature
19
- }),
20
- )
21
-
22
- def _split_generators(self, dl_manager):
23
- # Step 1: Download and extract the ZIP file from Hugging Face
24
- zip_path = dl_manager.download_and_extract("https://huggingface.co/datasets/sadjadalikhani/lwm/resolve/main/dataset.zip")
25
-
26
- # Step 2: Check the extracted files
27
- extracted_files = os.listdir(zip_path)
28
- print(f"Extracted files: {extracted_files}") # Debugging step
29
-
30
- # Step 3: Return the path to the .p file
31
- return [
32
- datasets.SplitGenerator(
33
- name=datasets.Split.TRAIN,
34
- gen_kwargs={"filepath": os.path.join(zip_path, "deepmimo_data.p")},
35
- ),
36
- ]
37
-
38
- def _generate_examples(self, filepath):
39
- # Step 4: Load the .p file using pickle
40
- if not os.path.exists(filepath):
41
- raise FileNotFoundError(f"File not found: {filepath}")
42
-
43
- print(f"Loading .p file from {filepath}") # Debugging step
44
-
45
- # Load the pickled data
46
- with open(filepath, "rb") as f:
47
- data = pickle.load(f)
48
-
49
- # Yield the loaded data
50
- yield 0, {"data": str(data)}
51
-