---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-16-c8dc3dc5d3d7> in <module>
----> 1 sentences = embeddings.embed_text(example_text, model_name_or_path="gpt2")
<ipython-input-11-1e6d4d6f8dd9> in embed_text(self, text, model_name_or_path)
51 return Sentence("")
52 embedding = self.models[model_name_or_path]
---> 53 return embedding.embed(sentences)
54
55 def embed_all(
/opt/venv/lib/python3.8/site-packages/flair/embeddings/base.py in embed(self, sentences)
58
59 if not everything_embedded or not self.static_embeddings:
---> 60 self._add_embeddings_internal(sentences)
61
62 return sentences
/opt/venv/lib/python3.8/site-packages/flair/embeddings/token.py in _add_embeddings_internal(self, sentences)
875 # embed each micro-batch
876 for batch in sentence_batches:
--> 877 self._add_embeddings_to_sentences(batch)
878
879 return sentences
/opt/venv/lib/python3.8/site-packages/flair/embeddings/token.py in _add_embeddings_to_sentences(self, sentences)
940 while subtoken_ids_sentence:
941 nr_sentence_parts += 1
--> 942 encoded_inputs = self.tokenizer.encode_plus(subtoken_ids_sentence,
943 max_length=self.max_subtokens_sequence_length,
944 stride=self.stride,
/opt/venv/lib/python3.8/site-packages/transformers/tokenization_utils_base.py in encode_plus(self, text, text_pair, add_special_tokens, padding, truncation, max_length, stride, is_split_into_words, pad_to_multiple_of, return_tensors, return_token_type_ids, return_attention_mask, return_overflowing_tokens, return_special_tokens_mask, return_offsets_mapping, return_length, verbose, **kwargs)
2418 )
2419
-> 2420 return self._encode_plus(
2421 text=text,
2422 text_pair=text_pair,
/opt/venv/lib/python3.8/site-packages/transformers/models/gpt2/tokenization_gpt2_fast.py in _encode_plus(self, *args, **kwargs)
167 )
168
--> 169 return super()._encode_plus(*args, **kwargs)
170
171 def save_vocabulary(self, save_directory: str, filename_prefix: Optional[str] = None) -> Tuple[str]:
/opt/venv/lib/python3.8/site-packages/transformers/tokenization_utils_fast.py in _encode_plus(self, text, text_pair, add_special_tokens, padding_strategy, truncation_strategy, max_length, stride, is_split_into_words, pad_to_multiple_of, return_tensors, return_token_type_ids, return_attention_mask, return_overflowing_tokens, return_special_tokens_mask, return_offsets_mapping, return_length, verbose, **kwargs)
453
454 batched_input = [(text, text_pair)] if text_pair else [text]
--> 455 batched_output = self._batch_encode_plus(
456 batched_input,
457 is_split_into_words=is_split_into_words,
/opt/venv/lib/python3.8/site-packages/transformers/models/gpt2/tokenization_gpt2_fast.py in _batch_encode_plus(self, *args, **kwargs)
157 )
158
--> 159 return super()._batch_encode_plus(*args, **kwargs)
160
161 def _encode_plus(self, *args, **kwargs) -> BatchEncoding:
/opt/venv/lib/python3.8/site-packages/transformers/tokenization_utils_fast.py in _batch_encode_plus(self, batch_text_or_text_pairs, add_special_tokens, padding_strategy, truncation_strategy, max_length, stride, is_split_into_words, pad_to_multiple_of, return_tensors, return_token_type_ids, return_attention_mask, return_overflowing_tokens, return_special_tokens_mask, return_offsets_mapping, return_length, verbose)
380 )
381
--> 382 encodings = self._tokenizer.encode_batch(
383 batch_text_or_text_pairs,
384 add_special_tokens=add_special_tokens,
TypeError: TextEncodeInput must be Union[TextInputSequence, Tuple[InputSequence, InputSequence]]