Skip to main content

Automate standard NLP impports

Project description

pygrove

Writing the same imports over and over is draining. Some imports are standard enough for automation. pyforest allows this, but it is not frequently updated and oriented towards general data science. Here, I provide other imports, including some huggingface libraries imports.

Installation

pip install pygrove

Usage

import pygrove
model = AutoModel.from_pretrained('roberta-base')
tokenizer = AutoTokenizer.from_pretrained('roberta-base') 

Please note that thanks to pyforest, pygrove imports are lazy. Objects do not require time or memory until they are actually called.

Imports

Here is the list of pygrove imports

# HuggingFace
datasets = LazyImport("import datasets")
load_metric = LazyImport("from datasets import load_metric")
load_dataset = LazyImport("from datasets import load_dataset")
Dataset = LazyImport("from datasets import Dataset")

transformers = LazyImport("import transformers")
Trainer = LazyImport("from transformers import Trainer")
TrainingArguments = LazyImport("from transformers import TrainingArguments")
AutoTokenizer = LazyImport("from transformers import AutoTokenizer")
AutoConfig = LazyImport("from transformers import AutoConfig")
AutoModel = LazyImport("from transformers import AutoModel")
AutoModelForSequenceClassification = LazyImport("from transformers import AutoModelForSequenceClassification")
AutoModelForTokenClassification = LazyImport("from transformers import AutoModelForTokenClassification")
AutoModelForMultipleChoice = LazyImport("from transformers import AutoModelForMultipleChoice")
AutoModelForQuestionAnswering = LazyImport("from transformers import AutoModelForQuestionAnswering")

# Helpers
ftfy = LazyImport("import ftfy")
fc = LazyImport("import funcy as fc")
warnings = LazyImport("import warnings")
tqdm = LazyImport("from tqdm.auto import tqdm")
random = LazyImport("import random")
itertools = LazyImport("import itertools")
appdirs = LazyImport("import appdirs")
copy = LazyImport("import copy")
defaultdict = LazyImport("from collections import defaultdict")
Counter = LazyImport("from collections import Counter")
edict = LazyImport("from easydict import EasyDict as edict")
Xp = LazyImport("from xpflow import Xp")
millify = LazyImport("from millify import millify")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygrove-1.6.0.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

pygrove-1.6.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file pygrove-1.6.0.tar.gz.

File metadata

  • Download URL: pygrove-1.6.0.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.0

File hashes

Hashes for pygrove-1.6.0.tar.gz
Algorithm Hash digest
SHA256 61406420e6dff0d7141b8614365158c54bfcdd11d7b2685a1bfd788292d76d02
MD5 b25560b5af7ad168db24972bb6719556
BLAKE2b-256 cbc79d6b6930ca601fa224bc2aead431cb36697e40b9060650d5a7bc41289093

See more details on using hashes here.

File details

Details for the file pygrove-1.6.0-py3-none-any.whl.

File metadata

  • Download URL: pygrove-1.6.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.0

File hashes

Hashes for pygrove-1.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2a791ce1e8946d8f6c9546d6cd3e586904b84193c79396cec11907f69aa6f297
MD5 e49c1af267a5b8ed73921ce5b5c21295
BLAKE2b-256 a70e3ce506ea82d488f7fd5ceab90656ee8e64c40365b1f7665d972cb9e9444b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page