Datasets:

Modalities:
Text
Formats:
parquet
ArXiv:
Libraries:
Datasets
Dask
License:
Research-EAI commited on
Commit
10363c6
·
verified ·
1 Parent(s): f96e79f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +120 -0
README.md CHANGED
@@ -499,6 +499,126 @@ df.filter(
499
 
500
  </details>
501
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
502
  ## 🎓 Citation
503
 
504
  If you use this dataset, please cite our EssentialWeb paper:
 
499
 
500
  </details>
501
 
502
+ ## How to Load the Dataset
503
+
504
+ This section provides examples of how to load the `Research-EAI/eai-taxonomy-math-w-fm` dataset using different Python libraries and frameworks.
505
+
506
+ ### Using Hugging Face Datasets (Standard Method)
507
+
508
+ The simplest way to load the dataset is using the Hugging Face `datasets` library:
509
+
510
+ ```python
511
+ from datasets import load_dataset
512
+
513
+ # Load the entire dataset
514
+ dataset = load_dataset("Research-EAI/eai-taxonomy-math-w-fm")
515
+
516
+ # View dataset structure
517
+ print(dataset)
518
+ print(f"Number of examples: {len(dataset['train'])}")
519
+ ```
520
+
521
+ You can also load the dataset in streaming mode to avoid downloading the entire dataset at once:
522
+
523
+ ```python
524
+ from datasets import load_dataset
525
+
526
+ # Load in streaming mode
527
+ dataset = load_dataset("Research-EAI/eai-taxonomy-math-w-fm", streaming=True)
528
+ data_stream = dataset["train"]
529
+
530
+ # Iterate through examples
531
+ for example in data_stream.take(5):
532
+ print(example)
533
+ ```
534
+
535
+ ### Using PySpark
536
+
537
+ For large-scale distributed processing, you can load the dataset using PySpark with the `pyspark_huggingface` library:
538
+
539
+ ```python
540
+ # First install the required library:
541
+ # pip install pyspark_huggingface
542
+
543
+ import pyspark_huggingface
544
+ from pyspark.sql import SparkSession
545
+
546
+ # Initialize Spark session
547
+ spark = SparkSession.builder.appName("EAI-Taxonomy-Math").getOrCreate()
548
+
549
+ # Load the dataset using the "huggingface" data source
550
+ df = spark.read.format("huggingface").load("Research-EAI/eai-taxonomy-math-w-fm")
551
+
552
+ # Basic dataset exploration
553
+ print(f"Dataset shape: {df.count()} rows, {len(df.columns)} columns")
554
+ df.show(10)
555
+ df.printSchema()
556
+
557
+ # Load only specific columns for efficiency
558
+ df_subset = (
559
+ spark.read.format("huggingface")
560
+ .option("columns", '["column1", "column2"]') # Replace with actual column names
561
+ .load("Research-EAI/eai-taxonomy-math-w-fm")
562
+ )
563
+
564
+ # Run SQL queries on the dataset
565
+ df.createOrReplaceTempView("eai_math_dataset")
566
+ result = spark.sql("""
567
+ SELECT COUNT(*) as total_examples
568
+ FROM eai_math_dataset
569
+ """)
570
+ result.show()
571
+ ```
572
+
573
+ ### Using Daft
574
+
575
+ Daft provides a modern DataFrame library optimized for machine learning workloads. You can load the dataset directly from Hugging Face:
576
+
577
+ ```python
578
+ import daft
579
+
580
+ # Load the entire dataset
581
+ df = daft.read_parquet("hf://datasets/Research-EAI/eai-taxonomy-math-w-fm")
582
+
583
+ # Basic exploration
584
+ print("Dataset schema:")
585
+ df.schema()
586
+
587
+ print("First 5 rows:")
588
+ df.show(5)
589
+ ```
590
+
591
+ If you need to access private datasets or use authentication:
592
+
593
+ ```python
594
+ import daft
595
+ import os
596
+
597
+ # Set your Hugging Face token
598
+ os.environ["HF_TOKEN"] = "your_huggingface_token_here"
599
+
600
+ # Load with authentication
601
+ df = daft.read_parquet(
602
+ "hf://datasets/Research-EAI/eai-taxonomy-math-w-fm",
603
+ hf_token=os.environ["HF_TOKEN"]
604
+ )
605
+ ```
606
+
607
+ ### Installation Requirements
608
+
609
+ Make sure you have the required libraries installed:
610
+
611
+ ```bash
612
+ # For Hugging Face datasets
613
+ pip install datasets
614
+
615
+ # For PySpark with Hugging Face integration
616
+ pip install pyspark_huggingface
617
+
618
+ # For Daft
619
+ pip install daft
620
+ ```
621
+
622
  ## 🎓 Citation
623
 
624
  If you use this dataset, please cite our EssentialWeb paper: