Pytorch example encoded_input fix
Browse filesThere is a problem like in t5-large from hugging face" with 'size'. Link to solved issue https://github.com/huggingface/transformers/issues/5480.
The returned object is a dict, not a tensor for the model. ['input_ids'] fixes PyTorch example.
README.md
CHANGED
@@ -25,7 +25,7 @@ Here is how to use this model to get the features of a given text in PyTorch:
|
|
25 |
tokenizer = BertTokenizer.from_pretrained('tbs17/MathBERT',output_hidden_states=True)
|
26 |
model = BertModel.from_pretrained("tbs17/MathBERT")
|
27 |
text = "Replace me by any text you'd like."
|
28 |
-
encoded_input = tokenizer(text, return_tensors='pt')
|
29 |
output = model(encoded_input)
|
30 |
```
|
31 |
and in TensorFlow:
|
|
|
25 |
tokenizer = BertTokenizer.from_pretrained('tbs17/MathBERT',output_hidden_states=True)
|
26 |
model = BertModel.from_pretrained("tbs17/MathBERT")
|
27 |
text = "Replace me by any text you'd like."
|
28 |
+
encoded_input = tokenizer(text, return_tensors='pt')["input_ids"]
|
29 |
output = model(encoded_input)
|
30 |
```
|
31 |
and in TensorFlow:
|