The repo contains additional functionality, not implemented in AllenNLP, for few-shot relation extraction / relation classification.
- Dataset reader for FewRel dataset
- N-way K-shot iterator, creating batches according to the few-shot scenario
- Few-shot relation classifier, configurable via jsonnet files (see experiments/config/ for examples)
- Relative offset embeddings (required for non-sequential models, i.e. CNN)
- Additional models for few-shot classification
- Prototypicial Network
$ pip install -r requirements.txt
$ allennlp train --include-package fewrel experiments/configs/baseline.jsonnet -s <RESULT DIR>
- Han, Xu et al. “FewRel: A Large-Scale Supervised Few-Shot Relation Classification Dataset with State-of-the-Art Evaluation.” EMNLP (2018).
- Snell, Jake et al. “Prototypical Networks for Few-shot Learning.” NIPS (2017).