Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
5a8c6e77
Commit
5a8c6e77
authored
Oct 12, 2019
by
Emrah Budur
Browse files
Fixed the sample code in the title 'Quick tour'.
parent
a701c9b3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
README.md
README.md
+3
-2
No files found.
README.md
View file @
5a8c6e77
...
...
@@ -176,10 +176,11 @@ BERT_MODEL_CLASSES = [BertModel, BertForPreTraining, BertForMaskedLM, BertForNex
# All the classes for an architecture can be initiated from pretrained weights for this architecture
# Note that additional weights added for fine-tuning are only initialized
# and need to be trained on the down-stream task
tokenizer
=
BertTokenizer
.
from_pretrained
(
'bert-base-uncased'
)
pretrained_weights
=
'bert-base-uncased'
tokenizer
=
BertTokenizer
.
from_pretrained
(
pretrained_weights
)
for
model_class
in
BERT_MODEL_CLASSES
:
# Load pretrained model/tokenizer
model
=
model_class
.
from_pretrained
(
'bert-base-uncased'
)
model
=
model_class
.
from_pretrained
(
pretrained_weights
)
# Models can return full list of hidden-states & attentions weights at each layer
model
=
model_class
.
from_pretrained
(
pretrained_weights
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment