patrickvonplaten
commited on
Commit
•
a8d257b
1
Parent(s):
af58a38
Update README.md
Browse files
README.md
CHANGED
@@ -82,9 +82,9 @@ You can use this model directly with a pipeline for masked language modeling:
|
|
82 |
Here is how to use this model to get the features of a given text in PyTorch:
|
83 |
|
84 |
```python
|
85 |
-
from transformers import BertTokenizer,
|
86 |
tokenizer = BertTokenizer.from_pretrained('bert-base-cased')
|
87 |
-
model =
|
88 |
text = "Replace me by any text you'd like."
|
89 |
encoded_input = tokenizer(text, return_tensors='pt')
|
90 |
output = model(**encoded_input)
|
@@ -93,9 +93,9 @@ output = model(**encoded_input)
|
|
93 |
and in TensorFlow:
|
94 |
|
95 |
```python
|
96 |
-
from transformers import BertTokenizer,
|
97 |
tokenizer = BertTokenizer.from_pretrained('bert-base-cased')
|
98 |
-
model =
|
99 |
text = "Replace me by any text you'd like."
|
100 |
encoded_input = tokenizer(text, return_tensors='tf')
|
101 |
output = model(encoded_input)
|
|
|
82 |
Here is how to use this model to get the features of a given text in PyTorch:
|
83 |
|
84 |
```python
|
85 |
+
from transformers import BertTokenizer, BertModel
|
86 |
tokenizer = BertTokenizer.from_pretrained('bert-base-cased')
|
87 |
+
model = BertModel.from_pretrained("bert-base-cased")
|
88 |
text = "Replace me by any text you'd like."
|
89 |
encoded_input = tokenizer(text, return_tensors='pt')
|
90 |
output = model(**encoded_input)
|
|
|
93 |
and in TensorFlow:
|
94 |
|
95 |
```python
|
96 |
+
from transformers import BertTokenizer, TFBertModel
|
97 |
tokenizer = BertTokenizer.from_pretrained('bert-base-cased')
|
98 |
+
model = TFBertModel.from_pretrained("bert-base-cased")
|
99 |
text = "Replace me by any text you'd like."
|
100 |
encoded_input = tokenizer(text, return_tensors='tf')
|
101 |
output = model(encoded_input)
|