"...git@developer.sourcefind.cn:modelzoo/solov2-pytorch.git" did not exist on "d2483e15fc48b4166815c15a6e12be864bcc521a"
processors.rst 3.46 KB
Newer Older
LysandreJik's avatar
LysandreJik committed
1
2
3
4
5
6
Processors
----------------------------------------------------

This library includes processors for several traditional tasks. These processors can be used to process a dataset into
examples that can be fed to a model.

7
Processors
LysandreJik's avatar
LysandreJik committed
8
9
~~~~~~~~~~~~~~~~~~~~~

10
All processors follow the same architecture which is that of the
11
12
13
14
:class:`~transformers.data.processors.utils.DataProcessor`. The processor returns a list
of :class:`~transformers.data.processors.utils.InputExample`. These
:class:`~transformers.data.processors.utils.InputExample` can be converted to
:class:`~transformers.data.processors.utils.InputFeatures` in order to be fed to the model.
LysandreJik's avatar
LysandreJik committed
15

16
.. autoclass:: transformers.data.processors.utils.DataProcessor
LysandreJik's avatar
LysandreJik committed
17
18
19
    :members:


20
.. autoclass:: transformers.data.processors.utils.InputExample
LysandreJik's avatar
LysandreJik committed
21
22
23
    :members:


24
.. autoclass:: transformers.data.processors.utils.InputFeatures
25
26
27
    :members:


28
29
GLUE
~~~~~~~~~~~~~~~~~~~~~
LysandreJik's avatar
LysandreJik committed
30

31
32
33
`General Language Understanding Evaluation (GLUE) <https://gluebenchmark.com/>`__ is a benchmark that evaluates
the performance of models across a diverse set of existing NLU tasks. It was released together with the paper
`GLUE: A multi-task benchmark and analysis platform for natural language understanding <https://openreview.net/pdf?id=rJ4km2R5t7>`__
LysandreJik's avatar
LysandreJik committed
34

35
36
This library hosts a total of 10 processors for the following tasks: MRPC, MNLI, MNLI (mismatched),
CoLA, SST2, STSB, QQP, QNLI, RTE and WNLI.
LysandreJik's avatar
LysandreJik committed
37

38
Those processors are:
39
40
41
42
43
44
45
46
47
    - :class:`~transformers.data.processors.utils.MrpcProcessor`
    - :class:`~transformers.data.processors.utils.MnliProcessor`
    - :class:`~transformers.data.processors.utils.MnliMismatchedProcessor`
    - :class:`~transformers.data.processors.utils.Sst2Processor`
    - :class:`~transformers.data.processors.utils.StsbProcessor`
    - :class:`~transformers.data.processors.utils.QqpProcessor`
    - :class:`~transformers.data.processors.utils.QnliProcessor`
    - :class:`~transformers.data.processors.utils.RteProcessor`
    - :class:`~transformers.data.processors.utils.WnliProcessor`
LysandreJik's avatar
LysandreJik committed
48

49
Additionally, the following method  can be used to load values from a data file and convert them to a list of
50
:class:`~transformers.data.processors.utils.InputExample`.
LysandreJik's avatar
LysandreJik committed
51

52
.. automethod:: transformers.data.processors.glue.glue_convert_examples_to_features
53
54
55

Example usage
^^^^^^^^^^^^^^^^^^^^^^^^^
LysandreJik's avatar
LysandreJik committed
56
57

An example using these processors is given in the
VictorSanh's avatar
VictorSanh committed
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
`run_glue.py <https://github.com/huggingface/pytorch-transformers/blob/master/examples/run_glue.py>`__ script.


XNLI
~~~~~~~~~~~~~~~~~~~~~

`The Cross-Lingual NLI Corpus (XNLI) <https://www.nyu.edu/projects/bowman/xnli/>`__ is a benchmark that evaluates
the quality of cross-lingual text representations. 
XNLI is crowd-sourced dataset based on `MultiNLI <http://www.nyu.edu/projects/bowman/multinli/>`: pairs of text are labeled with textual entailment 
annotations for 15 different languages (including both high-ressource language such as English and low-ressource languages such as Swahili).

It was released together with the paper
`XNLI: Evaluating Cross-lingual Sentence Representations <https://arxiv.org/abs/1809.05053>`__

This library hosts the processor to load the XNLI data:
    - :class:`~transformers.data.processors.utils.XnliProcessor`

Please note that since the gold labels are available on the test set, evaluation is performed on the test set.

Example usage
^^^^^^^^^^^^^^^^^^^^^^^^^

An example using these processors is given in the
`run_xnli.py <https://github.com/huggingface/pytorch-transformers/blob/master/examples/run_xnli.py>`__ script.