Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

support torchscriptify XLM-R #1138

Conversation

chenyangyu1988
Copy link
Contributor

Summary:
The core part of this diff is to determine use ScriptTextModule or ScriptTokenModule in RoBERTa.torchscriptify().
Given concrete example: GPT2BPE need use ScriptTextModule and SentencePiece need to use ScriptTokenModule

This diff have few changes

  1. Introduce ScriptInputType to determine to use ScriptTextModule or ScriptTokenModule
  2. ScriptTokenizer have API: input_type() to determine which ScriptInputType to support
  3. Add torchscriptify() API for SentencePieceTokenizer

Differential Revision: D18487692

@facebook-github-bot facebook-github-bot added CLA Signed Do not delete this pull request or issue due to inactivity. fb-exported labels Nov 13, 2019
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D18487692

chenyangyu1988 added a commit to chenyangyu1988/pytext that referenced this pull request Nov 13, 2019
Summary:
Pull Request resolved: facebookresearch#1138

The core part of this diff is to determine use ScriptTextModule or ScriptTokenModule in RoBERTa.torchscriptify().
Given concrete example: GPT2BPE need use ScriptTextModule and SentencePiece need to use ScriptTokenModule

This diff have few changes
1) Introduce ScriptInputType to determine to use ScriptTextModule or ScriptTokenModule
2) ScriptTokenizer have API: input_type() to determine which ScriptInputType to support
3) Add torchscriptify() API for SentencePieceTokenizer

Differential Revision: D18487692

fbshipit-source-id: 087ac278522273c4f9ba2bc3f99d57bc65fe0b16
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D18487692

Summary:
Pull Request resolved: facebookresearch#1138

The core part of this diff is to determine use ScriptTextModule or ScriptTokenModule in RoBERTa.torchscriptify().
Given concrete example: GPT2BPE need use ScriptTextModule and SentencePiece need to use ScriptTokenModule

This diff have few changes
1) Introduce ScriptInputType to determine to use ScriptTextModule or ScriptTokenModule
2) ScriptTokenizer have API: input_type() to determine which ScriptInputType to support
3) Add torchscriptify() API for SentencePieceTokenizer

Differential Revision: D18487692

fbshipit-source-id: eb41a77ecb2b67f8473659859892f7ef5d323cad
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D18487692

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in bc000a6.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLA Signed Do not delete this pull request or issue due to inactivity. fb-exported Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants