-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add DLRM Model Computational Graph #1532
base: repo-refactor
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 7 files reviewed, 2 unresolved discussions (waiting on @lockshaw and @reyna-abhyankar)
lib/models/src/models/dlrm/dlrm.cc
line 44 at r1 (raw file):
} tensor_guid_t create_dlrm_mlp(ComputationGraphBuilder &cgb,
This MLP implementation refers to the original FlexFlow implementation at https://github.com/flexflow/FlexFlow/blob/inference/examples/cpp/DLRM/dlrm.cc#L44. Not sure if there was a specific reason to do this in the past. We can decide what to do here. Torchrec doesn't have this logic to initialize the initializers.
@lockshaw
lib/models/src/models/dlrm/dlrm.cc
line 145 at r1 (raw file):
/*mlp_layers=*/config.dense_arch_layer_sizes); std::vector<tensor_guid_t> emb_outputs;
As suggested, I tried this:
std::vector<tensor_guid_t> emb_outputs = transform(
zip(config.embedding_size, sparse_inputs),
[&](std::pair<int, tensor_guid_t> &combined_pair) -> tensor_guid_t {
return create_dlrm_sparse_embedding_network(
/*cgb=*/cgb,
/*config=*/config,
/*input=*/combined_pair.second,
/*input_dim=*/combined_pair.first,
/*output_dim=*/config.embedding_dim);
});
But I couldn't make it compile by using transform and zip...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 7 files reviewed, 3 unresolved discussions (waiting on @lockshaw and @reyna-abhyankar)
lib/models/src/models/dlrm/dlrm.cc
line 128 at r1 (raw file):
// Create input tensors std::vector<tensor_guid_t> sparse_inputs(
This had the following review comment before:
Quote:
I think this current implementation makes sparse_inputs
a vector of the same tensor_guid_t
over and over again, rather than being a vector of identically-shaped tensors. Was that intentional? If not, then maybe the below code would be better?
std::vector<tensor_guid_t> sparse_inputs = repeat(config.embedding_size.size(), [&]() { return create_input_tensor({config.batch_size, config.embedding_bag_size}, DataType::INT64); });
The intention was to create multiple tensors as the inputs. I'm not sure if this vector creation syntax will lead to having all inputs referring to a single tensor? I would think create_input_tensor
should return a copy of tensor for each item in the vector?
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## repo-refactor #1532 +/- ##
=================================================
- Coverage 78.16% 78.12% -0.04%
=================================================
Files 860 862 +2
Lines 27994 28280 +286
Branches 770 774 +4
=================================================
+ Hits 21881 22095 +214
- Misses 6113 6185 +72
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Description of changes:
This PR adds the computational graph of DLRM model.
Related Issues:
Linked Issues:
Issues closed by this PR:
This change is