Main method to use reddit.py

#1
by Vijaya - opened

I am learning Python along with data science. Could you please share the "Main Method" code to use "reddit.py" in this dataset?
I got errors while using the below code.

I have tried below:

if __name__ == "__main__":
    data = Reddit()
    # path = data._split_generators()
    example = data._generate_examples()
    example1 = next(example)
    print(example1)

Hi @Vijaya ,

You have our docs here: https://huggingface.co/docs/datasets/index

For a quickstart, you have this: https://huggingface.co/docs/datasets/quickstart#nlp

  • To load the entire dataset:
from datasets import load_dataset

ds = load_dataset("reddit", split="train")
  • To load just an example, you can use streaming:
ds = load_dataset("reddit", split="train", streaming=True)
example = next(iter(ds))
albertvillanova changed discussion status to closed

Sign up or log in to comment