From 757baee8461e5c21bf4d412a2f4aaa3acb3c27c9 Mon Sep 17 00:00:00 2001 From: Julien Chaumond Date: Mon, 18 May 2020 11:20:46 -0400 Subject: [PATCH] Fix un-prefixed f-string see https://github.com/huggingface/transformers/pull/4367#discussion_r426356693 Hat/tip @girishponkiya --- examples/distillation/scripts/extract_distilbert.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/distillation/scripts/extract_distilbert.py b/examples/distillation/scripts/extract_distilbert.py index d709268c..15b48802 100644 --- a/examples/distillation/scripts/extract_distilbert.py +++ b/examples/distillation/scripts/extract_distilbert.py @@ -82,8 +82,8 @@ if __name__ == "__main__": compressed_sd["vocab_projector.bias"] = state_dict["cls.predictions.bias"] if args.vocab_transform: for w in ["weight", "bias"]: - compressed_sd[f"vocab_transform.{w}"] = state_dict["cls.predictions.transform.dense.{w}"] - compressed_sd[f"vocab_layer_norm.{w}"] = state_dict["cls.predictions.transform.LayerNorm.{w}"] + compressed_sd[f"vocab_transform.{w}"] = state_dict[f"cls.predictions.transform.dense.{w}"] + compressed_sd[f"vocab_layer_norm.{w}"] = state_dict[f"cls.predictions.transform.LayerNorm.{w}"] print(f"N layers selected for distillation: {std_idx}") print(f"Number of params transfered for distillation: {len(compressed_sd.keys())}")