Giter Club home page Giter Club logo

cltrier_promptclassify's Introduction

CLTrier PromptClassify

Usage

Python Module

from cltrier_promptClassify import Pipeline

# init pipeline object
pipeline = Pipeline({
    # pipeline objects
    'do_classification': True,
    'do_evaluation': True,
    'do_export': True,
    # path to export dir (only if do_export)
    'export_path': './path/dir/',
    # dataset configuration
    'dataset': {
        # path to data file (.csv)
        'path': './path/file.csv',
        # column containing src text
        'text_column': 'text',
        # column containing gold label (only if do_evaluation)
        'gold_column': 'gold',
        # (optional) batch size used during classification
        'batch_size': 16,
    },
    # classifier configuration
    'classifiers': [
        # label for export, slug/url from hugging face hub
        ['model_label', 'model_huggingface_slug'],
        # ...
    ],
    'templates': [
        # {classes}, {text} are dynamically replaced during runtime
        ['template_label', 'prompt_template (must include {classes} and {text})'],
        # ...
    ],
    # list of classes to use
    'classes': ['class_1', 'class_2']
})

# call pipeline object
pipeline()

Terminal Script

python3 -m cltrier_promptClassify ./path/to/config.toml
# pipeline objects
do_classification = true
do_evaluation = true
do_export = true
# path to export dir
export_path = './path/dir/'

# dataset configuration
[dataset]
# path to data file (.csv)
path = './path/file.csv'
# column containing src text
text_column = 'text'
# column containing gold label (only if do_evaluation)
gold_column = 'gold'
# (optional) batch size used during classification
batch_size = 16

# classifier configuration
[classify]
# label for export, slug/url from hugging face hub
models = [
    ['model_label', 'model_huggingface_slug'],
    # ...
]
# {classes}, {text} are dynamically replaced during runtime
templates = [
    ['template_label', 'prompt_template (must include {classes} and {text})'],
]
# list of classes to use
classes = ['class_1', 'class_2']

cltrier_promptclassify's People

Watchers

Simon Münker avatar

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.