Open Saichethan opened 4 years ago
@Saichethan Our huggingface compatible weights are only for PyTorch.
@kyleclo thanks for your response Then how can I get sentence embeddings in TF??
Hmm.. I'd probably ask the folks on the HuggingFace repo. We uploaded model weights according to their specification for PyTorch compatibility. I'm unfamiliar with how they handle tensorflow compatibility; that's going to be something specific to their platform
`` import tensorflow as tf from transformers import * #BertTokenizer, TFBertModel
tokenizer = AutoTokenizer.from_pretrained('allenai/scibert_scivocab_uncased') model = AutoModel.from_pretrained('allenai/scibert_scivocab_uncased')
input_ids = tf.constant(tokenizer.encode("My dog is cute"))[None, :] # Batch size 1
outputs = model(input_ids)
last_hidden_states = outputs[0] print(last_hidden_states) ``
I'm getting following error: input_shape = input_ids.size() AttributeError: 'tensorflow.python.framework.ops.EagerTensor' object has no attribute 'size'