pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/bartz-nvidia/DeepLearningExamples/commit/15a0678fcb4d4474d078c5195880a121fca2fc63

n="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/code-12d60eb17c94521c.css" /> [DLRM/TF2] Synthetic dataset bugfix · bartz-nvidia/DeepLearningExamples@15a0678 · GitHub
Skip to content

Commit 15a0678

Browse files
committed
[DLRM/TF2] Synthetic dataset bugfix
1 parent 8c7d66f commit 15a0678

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

TensorFlow2/Recommendation/DLRM/dataloader.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,14 @@ def create_input_pipelines(flags, table_ids):
5555
train_dataset = DummyDataset(batch_size=flags.batch_size,
5656
num_numerical_features=dataset_metadata.num_numerical_features,
5757
categorical_feature_cardinalities=local_table_sizes,
58-
num_batches=flags.synthetic_dataset_train_batches)
58+
num_batches=flags.synthetic_dataset_train_batches,
59+
num_workers=hvd.size())
5960

6061
test_dataset = DummyDataset(batch_size=flags.batch_size,
6162
num_numerical_features=dataset_metadata.num_numerical_features,
6263
categorical_feature_cardinalities=local_table_sizes,
63-
num_batches=flags.synthetic_dataset_valid_batches)
64+
num_batches=flags.synthetic_dataset_valid_batches,
65+
num_workers=hvd.size())
6466

6567
elif flags.dataset_type == 'tf_raw':
6668
local_categorical_feature_names = feature_spec.cat_positions_to_names(table_ids)

TensorFlow2/Recommendation/DLRM/datasets.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@
2828

2929

3030
class DummyDataset:
31-
def __init__(self, batch_size, num_numerical_features, categorical_feature_cardinalities, num_batches):
31+
def __init__(self, batch_size, num_numerical_features, categorical_feature_cardinalities, num_batches, num_workers):
3232
cat_features_count = len(
3333
categorical_feature_cardinalities) if categorical_feature_cardinalities is not None else 0
3434
num_features_count = num_numerical_features if num_numerical_features is not None else 0
3535

36-
self.numerical_features = tf.random.uniform(shape=[batch_size, num_numerical_features], dtype=tf.float32) \
36+
self.numerical_features = tf.random.uniform(shape=[batch_size // num_workers, num_numerical_features], dtype=tf.float32) \
3737
if num_features_count else -1
38-
self.labels = tf.cast(tf.random.uniform(shape=[batch_size, 1], maxval=2, dtype=tf.int32), tf.float32)
38+
self.labels = tf.cast(tf.random.uniform(shape=[batch_size // num_workers, 1], maxval=2, dtype=tf.int32), tf.float32)
3939
self.categorical_features = tf.concat(
4040
[tf.random.uniform(shape=[batch_size, 1], maxval=cardinality, dtype=tf.int32)
4141
for cardinality in categorical_feature_cardinalities], axis=1) if cat_features_count > 0 else -1

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy