From 39994051e43de9875059304331009eb45ccb9220 Mon Sep 17 00:00:00 2001 From: "Guo, Quan" <1118270+guoquan@users.noreply.github.com> Date: Mon, 11 May 2020 13:35:13 -0400 Subject: [PATCH] Add migrating from `pytorch-transformers` (#4273) "Migrating from pytorch-transformers to transformers" is missing in the main document. It is available in the main `readme` thought. Just move it to the document. --- docs/source/migration.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/source/migration.md b/docs/source/migration.md index d838bf5c43..557e0b809b 100644 --- a/docs/source/migration.md +++ b/docs/source/migration.md @@ -1,5 +1,18 @@ -# Migrating from pytorch-pretrained-bert +# Migrating from previous packages +## Migrating from pytorch-transformers to transformers + +Here is a quick summary of what you should take care of when migrating from `pytorch-transformers` to `transformers`. + +### Positional order of some models' keywords inputs (`attention_mask`, `token_type_ids`...) changed + +To be able to use Torchscript (see #1010, #1204 and #1195) the specific order of some models **keywords inputs** (`attention_mask`, `token_type_ids`...) has been changed. + +If you used to call the models with keyword names for keyword arguments, e.g. `model(inputs_ids, attention_mask=attention_mask, token_type_ids=token_type_ids)`, this should not cause any change. + +If you used to call the models with positional inputs for keyword arguments, e.g. `model(inputs_ids, attention_mask, token_type_ids)`, you may have to double check the exact order of input arguments. + +## Migrating from pytorch-pretrained-bert Here is a quick summary of what you should take care of when migrating from `pytorch-pretrained-bert` to `transformers`