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

thomwolf's avatar
thomwolf committed
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.

Lysandre's avatar
Lysandre committed
6
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
7

thomwolf's avatar
thomwolf committed
8
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 ``BertModel``).
thomwolf's avatar
thomwolf committed
9
10
11
12
13


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

14
.. autoclass:: transformers.AutoConfig
thomwolf's avatar
thomwolf committed
15
16
17
    :members:


Lysandre's avatar
Lysandre committed
18
19
20
21
22
23
24
``AutoTokenizer``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. autoclass:: transformers.AutoTokenizer
    :members:


thomwolf's avatar
thomwolf committed
25
26
27
``AutoModel``
~~~~~~~~~~~~~~~~~~~~~

28
.. autoclass:: transformers.AutoModel
thomwolf's avatar
thomwolf committed
29
30
31
    :members:


thomwolf's avatar
thomwolf committed
32
``AutoModelForPreTraining``
33
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
thomwolf's avatar
thomwolf committed
34
35
36
37
38

.. autoclass:: transformers.AutoModelForPreTraining
    :members:


Lysandre's avatar
Lysandre committed
39
``AutoModelWithLMHead``
40
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
thomwolf's avatar
thomwolf committed
41

Lysandre's avatar
Lysandre committed
42
.. autoclass:: transformers.AutoModelWithLMHead
thomwolf's avatar
thomwolf committed
43
    :members:
Lysandre's avatar
Lysandre committed
44
45
46


``AutoModelForSequenceClassification``
47
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lysandre's avatar
Lysandre committed
48
49
50
51
52
53

.. autoclass:: transformers.AutoModelForSequenceClassification
    :members:


``AutoModelForQuestionAnswering``
54
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lysandre's avatar
Lysandre committed
55
56
57
58
59
60

.. autoclass:: transformers.AutoModelForQuestionAnswering
    :members:


``AutoModelForTokenClassification``
61
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lysandre's avatar
Lysandre committed
62
63
64
65

.. autoclass:: transformers.AutoModelForTokenClassification
    :members: