Skip to main content

Textbook: Universal NLP Datasets

Current support few commonsense reasoning datsets(alphanli, hellaswag, physicaliqa, socialiqa, codah, and commonsenseqa). It adopts ray's multiprocessing in loading/processing the datasets.

Architecture

Architecture Image

Dependency

pip install -r requirements.txt

Download raw datasets

    bash fetch.sh

It downloads alphanli, hellaswag, physicaliqa, socialiqa, codah, and commonsenseqa from AWS. In case you want to use something-something, pelase download the dataset from 20bn's website.

Usage

Initialize ray

    import ray
    ray.init(memory=1024 * 1024 * 1024, num_cpus=2)

Load a dataset

    from transformers import BertTokenizer
    from textbook import *

    tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
    text_renderer = TextRenderer.remote(tokenizer)

    anli_tool = BatchTool(tokenizer, max_seq_len=128, source="anli")
    anli_dataset = TextDataset(path='data_cache/alphanli/eval.jsonl',
                                config=ANLIConfiguration.remote(), renderers=[text_renderer])
    # Batch by number of examples
    anli_iter = DataLoader(anli_dataset, batch_size=2, collate_fn=anli_tool.collate_fn)

    # Batch by number of tokens
    anli_iter = DataLoader(anli_dataset, batch_sampler=TokenBasedSampler(anli_dataset, batch_size=128), collate_fn=anli_tool.collate_fn)

Metadata

Release files for textbook 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for textbook 0.2.2
File Size Uploaded
textbook-0.2.2.tar.gz 8.7 kB Details

Release files / textbook-0.2.2.tar.gz

Download URL textbook-0.2.2.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
32d8a6fdb183d553f5fe094306f0c38ccc9d6ce76308b7c8e872d093d72fee5a
BLAKE2b-256 checksum
How to use checksums
a2afd4f20b2a13f9e9df6a685db2b590a86303cbc0f695490b3ef25bacf837d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.3

Release history Release notifications | RSS feed

0.3.10

2 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

1 release file

0.3.3

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.5

1 release file

0.2.4

1 release file

0.2.3

1 release file

This release

0.2.2 This release

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

0.0.9

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page