Giter Club home page Giter Club logo

custom_models_allennlp's Introduction

Creating and using custom models in allenNLP

This repository contains experiments for defining custom models in allenNLP and integrating them with the command line tools provided by the allenNLP framework.

Currently, this repository includes:

  • A simple Sequence classification model (custom/models.py) with a configurable Seq2Vec encoder (from the ones provided in allennlp/modules/seq2vec_encoders (https://github.com/allenai/allennlp/tree/master/allennlp/modules/seq2vec_encoders))
  • A simple jsonl reader (custom/readers.py) with configurable input and label fields
  • A simple csv/tsv reader (custom/readers.py) with simple configurable parameters
  • A predictor to be used for the Sequence classifier (custom/predictors.py)
  • A script setting up the predictor and wrapping a call to main() from the command line module of allenNLP
  • A folder with experiment definitions (experiments/definitions), including a simple BagOfEmbeddingClassifier for a really small subset of the Amazon Reviews dataset (data)

Assuming you have already installed allenNLP following https://github.com/allenai/allennlp, you can run the following

  • Train: python -m custom.run train experiments/definitions/sequence_boe_classifier.json -s experiments/output/boe
  • Predict: python -m custom.run predict experiments/output/boe/model.tar.gz data/amazon_reviews_video_games_5-1000.json.dev(of course this should be done with a different set of data, not used for training/evaluating the model, this is just for demonstration purposes

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.