DimOgu commited on
Commit
7f37b8a
1 Parent(s): 10b6054

Pytorch example encoded_input fix

Browse files

There 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.

Files changed (1) hide show
  1. README.md +1 -1
README.md CHANGED
@@ -49,7 +49,7 @@ Here is how to use this model to get the features of a given text in PyTorch:
49
  tokenizer = BertTokenizer.from_pretrained('tbs17/MathBERT-custom')
50
  model = BertModel.from_pretrained("tbs17/MathBERT-custom")
51
  text = "Replace me by any text you'd like."
52
- encoded_input = tokenizer(text, return_tensors='pt')
53
  output = model(encoded_input)
54
  ```
55
  and in TensorFlow:
 
49
  tokenizer = BertTokenizer.from_pretrained('tbs17/MathBERT-custom')
50
  model = BertModel.from_pretrained("tbs17/MathBERT-custom")
51
  text = "Replace me by any text you'd like."
52
+ encoded_input = tokenizer(text, return_tensors='pt')["input_ids"]
53
  output = model(encoded_input)
54
  ```
55
  and in TensorFlow: