From 032260c851e7ee2087f826997ebe3b5da7060b6e Mon Sep 17 00:00:00 2001 From: Benedikt Fuchs Date: Fri, 27 Oct 2023 17:41:27 +0200 Subject: [PATCH] fix embedding size for xlm roberta models --- flair/embeddings/transformer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flair/embeddings/transformer.py b/flair/embeddings/transformer.py index 8635825ee..552bad798 100644 --- a/flair/embeddings/transformer.py +++ b/flair/embeddings/transformer.py @@ -1139,8 +1139,8 @@ def is_supported_t5_model(config: PretrainedConfig) -> bool: # If we use a context separator, add a new special token self.use_context_separator = use_context_separator if use_context_separator: - self.tokenizer.add_special_tokens({"additional_special_tokens": [SENTENCE_BOUNDARY_TAG]}) - transformer_model.resize_token_embeddings(len(self.tokenizer)) + added = self.tokenizer.add_special_tokens({"additional_special_tokens": [SENTENCE_BOUNDARY_TAG]}) + transformer_model.resize_token_embeddings(transformer_model.config.vocab_size + added) super().__init__(**self.to_args())