auto.rst 2.4 KB
Newer Older
thomwolf's avatar
thomwolf committed
1
2
AutoModels
-----------
thomwolf's avatar
thomwolf committed
3

4
5
In many cases, the architecture you want to use can be guessed from the name or the path of the pretrained model you
are supplying to the ``from_pretrained`` method.
thomwolf's avatar
thomwolf committed
6

7
8
AutoClasses are here to do this job for you so that you automatically retrieve the relevant model given the name/path
to the pretrained weights/config/vocabulary:
thomwolf's avatar
thomwolf committed
9

10
11
12
Instantiating one of ``AutoModel``, ``AutoConfig`` and ``AutoTokenizer`` will directly create a class of the relevant
architecture (ex: ``model = AutoModel.from_pretrained('bert-base-cased')`` will create a instance of 
:class:`~transformers.BertModel`).
thomwolf's avatar
thomwolf committed
13
14
15
16
17


``AutoConfig``
~~~~~~~~~~~~~~~~~~~~~

18
.. autoclass:: transformers.AutoConfig
thomwolf's avatar
thomwolf committed
19
20
21
    :members:


Lysandre's avatar
Lysandre committed
22
23
24
25
26
27
28
``AutoTokenizer``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. autoclass:: transformers.AutoTokenizer
    :members:


thomwolf's avatar
thomwolf committed
29
30
31
``AutoModel``
~~~~~~~~~~~~~~~~~~~~~

32
.. autoclass:: transformers.AutoModel
thomwolf's avatar
thomwolf committed
33
34
35
    :members:


thomwolf's avatar
thomwolf committed
36
``AutoModelForPreTraining``
37
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
thomwolf's avatar
thomwolf committed
38
39
40
41
42

.. autoclass:: transformers.AutoModelForPreTraining
    :members:


Lysandre's avatar
Lysandre committed
43
``AutoModelWithLMHead``
44
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
thomwolf's avatar
thomwolf committed
45

Lysandre's avatar
Lysandre committed
46
.. autoclass:: transformers.AutoModelWithLMHead
thomwolf's avatar
thomwolf committed
47
    :members:
Lysandre's avatar
Lysandre committed
48
49
50


``AutoModelForSequenceClassification``
51
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lysandre's avatar
Lysandre committed
52
53
54
55
56
57

.. autoclass:: transformers.AutoModelForSequenceClassification
    :members:


``AutoModelForQuestionAnswering``
58
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lysandre's avatar
Lysandre committed
59
60
61
62
63
64

.. autoclass:: transformers.AutoModelForQuestionAnswering
    :members:


``AutoModelForTokenClassification``
65
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lysandre's avatar
Lysandre committed
66
67
68
69

.. autoclass:: transformers.AutoModelForTokenClassification
    :members:

70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
``TFAutoModel``
~~~~~~~~~~~~~~~~~~~~~

.. autoclass:: transformers.TFAutoModel
    :members:


``TFAutoModelForPreTraining``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. autoclass:: transformers.TFAutoModelForPreTraining
    :members:


``TFAutoModelWithLMHead``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. autoclass:: transformers.TFAutoModelWithLMHead
    :members:


``TFAutoModelForSequenceClassification``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. autoclass:: transformers.TFAutoModelForSequenceClassification
    :members:


``TFAutoModelForQuestionAnswering``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. autoclass:: transformers.TFAutoModelForQuestionAnswering
    :members:


``TFAutoModelForTokenClassification``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. autoclass:: transformers.TFAutoModelForTokenClassification
    :members: