torchrec icon indicating copy to clipboard operation
torchrec copied to clipboard

register custom_op for fpEBC

Open TroyGarden opened this issue 1 year ago • 11 comments

Summary:

context

  • convert FeatureProcessedEmbeddingBagCollection to custom op in IR export
  • add serialization and deserialization function for FPEBC
  • add an API for the FeatureProcessorInterface to export necessary paramters for create an instance
  • use this API (get_init_kwargs) in the serialize and deserialize functions to flatten and unflatten the feature processor

details

  1. Added FPEBCMetadata schema for FP_EBC, use a fp_json string to store the necessary paramters
  2. Added FPEBCJsonSerializer, converted the init_kwargs to json string and store in the fp_json field in the metadata
  3. Added a fqn check for serialized_fqns, so that when a higher-level module is serialized, the lower-level module can be skipped (it's already included in the higher-level module)
  4. Added an API called get_init_kwargs for FeatureProcessorsCollection and FeatureProcessor, and use a FeatureProcessorNameMap to map the classname to the feature processor class
  5. Added _non_strict_exporting_forward function for FPEBC so that in non_strict IR export it goes to the custom_op logic

Differential Revision: D57829276

TroyGarden avatar Jun 04 '24 05:06 TroyGarden

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

facebook-github-bot avatar Jun 04 '24 05:06 facebook-github-bot

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

facebook-github-bot avatar Jun 04 '24 17:06 facebook-github-bot

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

facebook-github-bot avatar Jun 04 '24 22:06 facebook-github-bot

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

facebook-github-bot avatar Jun 05 '24 15:06 facebook-github-bot

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

facebook-github-bot avatar Jun 06 '24 20:06 facebook-github-bot

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

facebook-github-bot avatar Jun 07 '24 23:06 facebook-github-bot

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

facebook-github-bot avatar Jun 17 '24 22:06 facebook-github-bot

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

facebook-github-bot avatar Jun 18 '24 08:06 facebook-github-bot

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

facebook-github-bot avatar Jun 22 '24 03:06 facebook-github-bot

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

facebook-github-bot avatar Jun 25 '24 06:06 facebook-github-bot

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

facebook-github-bot avatar Jun 25 '24 23:06 facebook-github-bot

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

facebook-github-bot avatar Jul 01 '24 19:07 facebook-github-bot