资源算法custom_models_allennlp

custom_models_allennlp

2020-04-08 | |  31 |   0 |   0

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


上一篇:allennlp-language-modeling

下一篇:AllenNLP_Practice

用户评价
全部评价

热门资源

  • seetafaceJNI

    项目介绍 基于中科院seetaface2进行封装的JAVA...

  • spark-corenlp

    This package wraps Stanford CoreNLP annotators ...

  • Keras-ResNeXt

    Keras ResNeXt Implementation of ResNeXt models...

  • capsnet-with-caps...

    CapsNet with capsule-wise convolution Project ...

  • shih-styletransfer

    shih-styletransfer Code from Style Transfer ...