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

Unify input for TorchScript Tensorizers and Models #1256

Closed
wants to merge 1 commit into from

Conversation

hudeven
Copy link
Contributor

@hudeven hudeven commented Feb 18, 2020

Summary:

Dataflow from PyText client to TorchScript model in predictor

  1. Client sends optional "texts", "tokens", "languages", "dense_feat" args in predictor request
  2. Predictor pass them to forward() of TorchScript Module(Tensorizer + Model)
  3. In ScriptPyTextModule(texts, tokens, languages, dense_feat), the args are converted to ScriptBatchInput(NamedTuple) => Tensorizer.forward() => tuple of Tensors => Model.forward()

Before:

We need a wrapper for each combination of (texts, tokens, languages, dense)

After:

a wrapper for with dense, another wrapper for without dense feature

Alternative:

ScriptPyTextModule(inputs: ScriptBatchInput)
after NamedTuple is supported in client example => predictor => ScriptPyTextModule
https://fb.workplace.com/groups/811605488888068/permalink/3266598560055403/

Reviewed By: chenyangyu1988

Differential Revision: D19900062

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

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

…1256)

Summary:
Pull Request resolved: facebookresearch#1256

## Dataflow from PyText client to TorchScript model in predictor

1. Client sends optional "texts", "tokens", "languages", "dense_feat" args in predictor request
2. Predictor pass them to forward() of TorchScript Module(Tensorizer + Model)
3. In ScriptPyTextModule(texts, tokens, languages, dense_feat), the args are converted to ScriptBatchInput(NamedTuple)  => Tensorizer.forward() => tuple of Tensors => Model.forward()

## Before:
We need a wrapper for each combination of (texts, tokens, languages, dense)

## After:
a wrapper for with dense, another wrapper for without dense feature

## Alternative:
ScriptPyTextModule(inputs: ScriptBatchInput)
after NamedTuple is supported in client example => predictor => ScriptPyTextModule
https://fb.workplace.com/groups/811605488888068/permalink/3266598560055403/

Reviewed By: chenyangyu1988

Differential Revision: D19900062

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

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

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 898c41c.

@hudeven hudeven deleted the export-D19900062 branch April 6, 2020 23:51
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