From 89ac5cc25ea1a3811ce982f79c8c8799c1e307f0 Mon Sep 17 00:00:00 2001 From: Konstantin Dobler Date: Thu, 12 Sep 2024 16:18:37 +0200 Subject: [PATCH] Update README.md --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index bf750f3..c7ba7ba 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,17 @@ target_embeddings = FOCUS( source_model.resize_token_embeddings(len(target_tokenizer)) source_model.get_input_embeddings().weight.data = target_embeddings +# if the model has separate output embeddings, apply FOCUS separately +if not model.config.tie_word_embeddings: + target_output_embeddings = FOCUS( + source_embeddings=source_model.get_output_embeddings().weight, + source_tokenizer=source_tokenizer, + target_tokenizer=target_tokenizer, + target_training_data_path="/path/to/data.txt" + # same argument options as above, fasttext models are cached! + ) + model.get_output_embeddings().weight.data = target_output_embeddings + # Continue training the model on the target language with `target_tokenizer`. # ... ```