Commit a77cf3b
Implement a write method in DMP (#3801)
Summary:
Pull Request resolved: #3801
TorchRec allows users to create embeddings with custom input. This was done in D78749760.
In this diff I expose this method to DistributedDataParallel (DMP), so that for modules with config enable_embedding_update = True, DMP will be able to update the embeddings with custom input.
**Approach**
We recursively initialize writable modules in `_init_dmp` method and when callers call `write` update all found modules with provided kjt
Reviewed By: kausv
Differential Revision: D93914739
fbshipit-source-id: 38f2019c079df325dbe246b7dea79de80a6f113f1 parent bbcc55c commit a77cf3b
File tree
4 files changed
+273
-47
lines changed- torchrec/distributed
- tests
4 files changed
+273
-47
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
78 | 77 | | |
79 | 78 | | |
80 | 79 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
498 | 498 | | |
499 | 499 | | |
500 | 500 | | |
| 501 | + | |
501 | 502 | | |
502 | 503 | | |
503 | 504 | | |
| |||
1685 | 1686 | | |
1686 | 1687 | | |
1687 | 1688 | | |
| 1689 | + | |
1688 | 1690 | | |
1689 | 1691 | | |
1690 | 1692 | | |
| |||
1694 | 1696 | | |
1695 | 1697 | | |
1696 | 1698 | | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
1697 | 1703 | | |
1698 | 1704 | | |
1699 | 1705 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
| |||
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
43 | | - | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
64 | | - | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
80 | 114 | | |
81 | 115 | | |
82 | 116 | | |
| |||
297 | 331 | | |
298 | 332 | | |
299 | 333 | | |
| 334 | + | |
300 | 335 | | |
301 | 336 | | |
302 | 337 | | |
| |||
462 | 497 | | |
463 | 498 | | |
464 | 499 | | |
| 500 | + | |
465 | 501 | | |
466 | 502 | | |
467 | 503 | | |
| |||
613 | 649 | | |
614 | 650 | | |
615 | 651 | | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
616 | 664 | | |
617 | 665 | | |
618 | 666 | | |
| |||
0 commit comments