Skip to content

Commit

Permalink
import fbgemm sparse_ops before compilation (pytorch#2144)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: pytorch#2144

Importing fbgemm.sparse_ops that are needed for torchrec compilation before model.compile call.
The main concern is torch.package tests.

Reviewed By: gnahzg, Microve

Differential Revision: D58830081

fbshipit-source-id: 3497f996c881d9c05814e779e68153b7956dc316
  • Loading branch information
Ivan Kobzarev authored and facebook-github-bot committed Jun 21, 2024
1 parent 8446d88 commit a117ae2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions torchrec/distributed/train_pipeline/train_pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ def progress(self, dataloader_iter: Iterator[In]) -> Out:
torch._dynamo.config.force_unspec_int_unbacked_size_like_on_torchrec_kjt = (
True
)

# Importing only before compilation to not slow-done train_pipelines import
torch.ops.import_module("fbgemm_gpu.sparse_ops")

self._model.compile(
fullgraph=cc.fullgraph, dynamic=cc.dynamic, backend=cc.backend
)
Expand Down

0 comments on commit a117ae2

Please sign in to comment.