Commit ccf78f8
Enable Optimizer Storing & Fix incomplete updates to Sharded EBC attributes in resharding (meta-pytorch#2911)
Summary:
Pull Request resolved: meta-pytorch#2911
Previously the dynamic sharding unit test was incomplete in truly verifying that a resharded EBC has all the attributes updated correctly. I ran into these issues when trying to enable optimizer state storing and DMP interface in D73049934
Main changes:
1. Add in dynamic sharding unit test's `are_sharded_ebc_modules_identical` the private attributes for ShardedEmbeddingCollection. This method will only compare primitive types or primitive reference types and tensors
1. This helped identify the gaps in current DS implementation - namely `module_sharding_plan`, `_embedding_dims`, `_uncombined_embedding_names`, `_uncombined_embedding_dims` not being updated correctly to reflect the new shard placements & order
2. Add in updates to `module_sharding_plan`, `_embedding_dims`, `_uncombined_embedding_names`, `_uncombined_embedding_dims` in reshard API for Sharded EBC.
3. Add in call to update Optimizer. The diff splits are not ideal, but the full optimizer unit test will be added in D73049934
Reviewed By: iamzainhuda
Differential Revision: D73530909
fbshipit-source-id: c1ab679cfe0925eef984d415b03b08634c05a4611 parent f2a8c3c commit ccf78f8
File tree
3 files changed
+93
-7
lines changed- torchrec/distributed
- sharding
- tests
3 files changed
+93
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| |||
1232 | 1233 | | |
1233 | 1234 | | |
1234 | 1235 | | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
1235 | 1239 | | |
1236 | 1240 | | |
1237 | 1241 | | |
1238 | 1242 | | |
1239 | 1243 | | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
1240 | 1249 | | |
1241 | 1250 | | |
1242 | 1251 | | |
| |||
1585 | 1594 | | |
1586 | 1595 | | |
1587 | 1596 | | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
1588 | 1617 | | |
1589 | 1618 | | |
1590 | 1619 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
145 | | - | |
146 | | - | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
147 | 147 | | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | 148 | | |
152 | 149 | | |
153 | 150 | | |
| |||
170 | 167 | | |
171 | 168 | | |
172 | 169 | | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
173 | 216 | | |
174 | 217 | | |
175 | 218 | | |
| |||
274 | 317 | | |
275 | 318 | | |
276 | 319 | | |
277 | | - | |
| 320 | + | |
278 | 321 | | |
279 | 322 | | |
280 | 323 | | |
| |||
0 commit comments