Giter VIP home page Giter VIP logo

pygrove's Introduction

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")

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.