Skip to content

Enable Global Weight Decay for VBE#2507

Closed
spcyppt wants to merge 1 commit into
pytorch:mainfrom
spcyppt:export-D56200676
Closed

Enable Global Weight Decay for VBE#2507
spcyppt wants to merge 1 commit into
pytorch:mainfrom
spcyppt:export-D56200676

Conversation

@spcyppt

@spcyppt spcyppt commented Apr 17, 2024

Copy link
Copy Markdown
Contributor

Summary:
Enable Global weight decay for VBE

Usage:
set

optimizer = OptimType.EXACT_ROWWISE_ADAGRAD
weight_decay_mode = WeightDecayMode.DECOUPLE_GLOBAL

#  for VBE, pass batch_size_per_feature_per_rank
# Example: num_features = 2, num_ranks = 4
batch_size_per_feature_per_rank = [
    [1,  2, 8, 3] # batch sizes for [Rank 0, Rank 1, Rank 2, Rank 3] in Feature 0
    [6, 10, 3, 5] # batch sizes for [Rank 0, Rank 1, Rank 2, Rank 3] in Feature 1
]

e.g.,

tbe = SplitTableBatchedEmbeddingBagsCodegen(
            embedding_specs=[
                (E, D, managed_option, ComputeDevice.CUDA) for (E, D) in zip(Es, Ds)
            ],
            optimizer=OptimType.EXACT_ROWWISE_ADAGRAD,
            learning_rate=0.1,
            eps=0.1,
            output_dtype=output_dtype,
            pooling_mode=pooling_mode,
            weight_decay_mode=WeightDecayMode.DECOUPLE_GLOBAL,
        )
output = tbe(indices, offsets, batch_size_per_feature_per_rank=batch_size_per_feature_per_rank)

Relevant diffs:
D53866750
D55660277
D55660762

Differential Revision: D56200676

@netlify

netlify Bot commented Apr 17, 2024

Copy link
Copy Markdown

Deploy Preview for pytorch-fbgemm-docs ready!

Name Link
🔨 Latest commit 7ec38f6
🔍 Latest deploy log https://app.netlify.com/sites/pytorch-fbgemm-docs/deploys/66845e471c5d0c0008b93f83
😎 Deploy Preview https://deploy-preview-2507--pytorch-fbgemm-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D56200676

@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D56200676

spcyppt added a commit to spcyppt/FBGEMM that referenced this pull request Apr 17, 2024
Summary:
Pull Request resolved: pytorch#2507

Enable Global weight decay for VBE
 ---
**Usage:**
set
```
optimizer = OptimType.EXACT_ROWWISE_ADAGRAD
weight_decay_mode = WeightDecayMode.DECOUPLE_GLOBAL

#  for VBE, pass batch_size_per_feature_per_rank
# Example: num_features = 2, num_ranks = 4
batch_size_per_feature_per_rank = [
    [1,  2, 8, 3] # batch sizes for [Rank 0, Rank 1, Rank 2, Rank 3] in Feature 0
    [6, 10, 3, 5] # batch sizes for [Rank 0, Rank 1, Rank 2, Rank 3] in Feature 1
]
```

e.g.,
```
tbe = SplitTableBatchedEmbeddingBagsCodegen(
            embedding_specs=[
                (E, D, managed_option, ComputeDevice.CUDA) for (E, D) in zip(Es, Ds)
            ],
            optimizer=OptimType.EXACT_ROWWISE_ADAGRAD,
            learning_rate=0.1,
            eps=0.1,
            output_dtype=output_dtype,
            pooling_mode=pooling_mode,
            weight_decay_mode=WeightDecayMode.DECOUPLE_GLOBAL,
        )
output = tbe(indices, offsets, batch_size_per_feature_per_rank=batch_size_per_feature_per_rank)
```
Relevant diffs:
D53866750
D55660277
D55660762

Differential Revision: D56200676
spcyppt added a commit to spcyppt/FBGEMM that referenced this pull request May 2, 2024
Summary:
Pull Request resolved: pytorch#2507

Enable Global weight decay for VBE
 ---
**Usage:**
set
```
optimizer = OptimType.EXACT_ROWWISE_ADAGRAD
weight_decay_mode = WeightDecayMode.DECOUPLE_GLOBAL

#  for VBE, pass batch_size_per_feature_per_rank
# Example: num_features = 2, num_ranks = 4
batch_size_per_feature_per_rank = [
    [1,  2, 8, 3] # batch sizes for [Rank 0, Rank 1, Rank 2, Rank 3] in Feature 0
    [6, 10, 3, 5] # batch sizes for [Rank 0, Rank 1, Rank 2, Rank 3] in Feature 1
]
```

e.g.,
```
tbe = SplitTableBatchedEmbeddingBagsCodegen(
            embedding_specs=[
                (E, D, managed_option, ComputeDevice.CUDA) for (E, D) in zip(Es, Ds)
            ],
            optimizer=OptimType.EXACT_ROWWISE_ADAGRAD,
            learning_rate=0.1,
            eps=0.1,
            output_dtype=output_dtype,
            pooling_mode=pooling_mode,
            weight_decay_mode=WeightDecayMode.DECOUPLE_GLOBAL,
        )
output = tbe(indices, offsets, batch_size_per_feature_per_rank=batch_size_per_feature_per_rank)
```
Relevant diffs:
D53866750
D55660277
D55660762

Differential Revision: D56200676
@spcyppt spcyppt force-pushed the export-D56200676 branch from 72f21ee to d7274df Compare May 2, 2024 07:47
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D56200676

1 similar comment
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D56200676

@spcyppt spcyppt force-pushed the export-D56200676 branch from d7274df to 3e4d361 Compare July 2, 2024 01:03
spcyppt added a commit to spcyppt/FBGEMM that referenced this pull request Jul 2, 2024
Summary:
Pull Request resolved: pytorch#2507

Enable Global weight decay for VBE
 ---
**Usage:**
set
```
optimizer = OptimType.EXACT_ROWWISE_ADAGRAD
weight_decay_mode = WeightDecayMode.DECOUPLE_GLOBAL

#  for VBE, pass batch_size_per_feature_per_rank
# Example: num_features = 2, num_ranks = 4
batch_size_per_feature_per_rank = [
    [1,  2, 8, 3] # batch sizes for [Rank 0, Rank 1, Rank 2, Rank 3] in Feature 0
    [6, 10, 3, 5] # batch sizes for [Rank 0, Rank 1, Rank 2, Rank 3] in Feature 1
]
```

e.g.,
```
tbe = SplitTableBatchedEmbeddingBagsCodegen(
            embedding_specs=[
                (E, D, managed_option, ComputeDevice.CUDA) for (E, D) in zip(Es, Ds)
            ],
            optimizer=OptimType.EXACT_ROWWISE_ADAGRAD,
            learning_rate=0.1,
            eps=0.1,
            output_dtype=output_dtype,
            pooling_mode=pooling_mode,
            weight_decay_mode=WeightDecayMode.DECOUPLE_GLOBAL,
        )
output = tbe(indices, offsets, batch_size_per_feature_per_rank=batch_size_per_feature_per_rank)
```
Relevant diffs:
D53866750
D55660277
D55660762

Reviewed By: sryap

Differential Revision: D56200676
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D56200676

spcyppt added a commit to spcyppt/FBGEMM that referenced this pull request Jul 2, 2024
Summary:
Pull Request resolved: pytorch#2507

Enable Global weight decay for VBE
 ---
**Usage:**
set
```
optimizer = OptimType.EXACT_ROWWISE_ADAGRAD
weight_decay_mode = WeightDecayMode.DECOUPLE_GLOBAL

#  for VBE, pass batch_size_per_feature_per_rank
# Example: num_features = 2, num_ranks = 4
batch_size_per_feature_per_rank = [
    [1,  2, 8, 3] # batch sizes for [Rank 0, Rank 1, Rank 2, Rank 3] in Feature 0
    [6, 10, 3, 5] # batch sizes for [Rank 0, Rank 1, Rank 2, Rank 3] in Feature 1
]
```

e.g.,
```
tbe = SplitTableBatchedEmbeddingBagsCodegen(
            embedding_specs=[
                (E, D, managed_option, ComputeDevice.CUDA) for (E, D) in zip(Es, Ds)
            ],
            optimizer=OptimType.EXACT_ROWWISE_ADAGRAD,
            learning_rate=0.1,
            eps=0.1,
            output_dtype=output_dtype,
            pooling_mode=pooling_mode,
            weight_decay_mode=WeightDecayMode.DECOUPLE_GLOBAL,
        )
output = tbe(indices, offsets, batch_size_per_feature_per_rank=batch_size_per_feature_per_rank)
```
Relevant diffs:
D53866750
D55660277
D55660762

Reviewed By: sryap

Differential Revision: D56200676
@spcyppt spcyppt force-pushed the export-D56200676 branch from 3e4d361 to 2ae3a71 Compare July 2, 2024 01:20
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D56200676

spcyppt added a commit to spcyppt/FBGEMM that referenced this pull request Jul 2, 2024
Summary:
Pull Request resolved: pytorch#2507

Enable Global weight decay for VBE
 ---
**Usage:**
set
```
optimizer = OptimType.EXACT_ROWWISE_ADAGRAD
weight_decay_mode = WeightDecayMode.DECOUPLE_GLOBAL

#  for VBE, pass batch_size_per_feature_per_rank
# Example: num_features = 2, num_ranks = 4
batch_size_per_feature_per_rank = [
    [1,  2, 8, 3] # batch sizes for [Rank 0, Rank 1, Rank 2, Rank 3] in Feature 0
    [6, 10, 3, 5] # batch sizes for [Rank 0, Rank 1, Rank 2, Rank 3] in Feature 1
]
```

e.g.,
```
tbe = SplitTableBatchedEmbeddingBagsCodegen(
            embedding_specs=[
                (E, D, managed_option, ComputeDevice.CUDA) for (E, D) in zip(Es, Ds)
            ],
            optimizer=OptimType.EXACT_ROWWISE_ADAGRAD,
            learning_rate=0.1,
            eps=0.1,
            output_dtype=output_dtype,
            pooling_mode=pooling_mode,
            weight_decay_mode=WeightDecayMode.DECOUPLE_GLOBAL,
        )
output = tbe(indices, offsets, batch_size_per_feature_per_rank=batch_size_per_feature_per_rank)
```
Relevant diffs:
D53866750
D55660277
D55660762

Reviewed By: sryap

Differential Revision: D56200676
@spcyppt spcyppt force-pushed the export-D56200676 branch from 2ae3a71 to e5f2b58 Compare July 2, 2024 01:33
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D56200676

@spcyppt spcyppt force-pushed the export-D56200676 branch from 7362242 to 4b017aa Compare July 2, 2024 02:45
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D56200676

spcyppt added a commit to spcyppt/FBGEMM that referenced this pull request Jul 2, 2024
Summary:
Pull Request resolved: pytorch#2507

Enable Global weight decay for VBE
 ---
**Usage:**
set
```
optimizer = OptimType.EXACT_ROWWISE_ADAGRAD
weight_decay_mode = WeightDecayMode.DECOUPLE_GLOBAL

#  for VBE, pass batch_size_per_feature_per_rank
# Example: num_features = 2, num_ranks = 4
batch_size_per_feature_per_rank = [
    [1,  2, 8, 3] # batch sizes for [Rank 0, Rank 1, Rank 2, Rank 3] in Feature 0
    [6, 10, 3, 5] # batch sizes for [Rank 0, Rank 1, Rank 2, Rank 3] in Feature 1
]
```

e.g.,
```
tbe = SplitTableBatchedEmbeddingBagsCodegen(
            embedding_specs=[
                (E, D, managed_option, ComputeDevice.CUDA) for (E, D) in zip(Es, Ds)
            ],
            optimizer=OptimType.EXACT_ROWWISE_ADAGRAD,
            learning_rate=0.1,
            eps=0.1,
            output_dtype=output_dtype,
            pooling_mode=pooling_mode,
            weight_decay_mode=WeightDecayMode.DECOUPLE_GLOBAL,
        )
output = tbe(indices, offsets, batch_size_per_feature_per_rank=batch_size_per_feature_per_rank)
```
Relevant diffs:
D53866750
D55660277
D55660762

Reviewed By: sryap

Differential Revision: D56200676
@spcyppt spcyppt force-pushed the export-D56200676 branch from 4b017aa to dee4542 Compare July 2, 2024 18:56
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D56200676

spcyppt added a commit to spcyppt/FBGEMM that referenced this pull request Jul 2, 2024
Summary:
Pull Request resolved: pytorch#2507

Enable Global weight decay for VBE
 ---
**Usage:**
set
```
optimizer = OptimType.EXACT_ROWWISE_ADAGRAD
weight_decay_mode = WeightDecayMode.DECOUPLE_GLOBAL

#  for VBE, pass batch_size_per_feature_per_rank
# Example: num_features = 2, num_ranks = 4
batch_size_per_feature_per_rank = [
    [1,  2, 8, 3] # batch sizes for [Rank 0, Rank 1, Rank 2, Rank 3] in Feature 0
    [6, 10, 3, 5] # batch sizes for [Rank 0, Rank 1, Rank 2, Rank 3] in Feature 1
]
```

e.g.,
```
tbe = SplitTableBatchedEmbeddingBagsCodegen(
            embedding_specs=[
                (E, D, managed_option, ComputeDevice.CUDA) for (E, D) in zip(Es, Ds)
            ],
            optimizer=OptimType.EXACT_ROWWISE_ADAGRAD,
            learning_rate=0.1,
            eps=0.1,
            output_dtype=output_dtype,
            pooling_mode=pooling_mode,
            weight_decay_mode=WeightDecayMode.DECOUPLE_GLOBAL,
        )
output = tbe(indices, offsets, batch_size_per_feature_per_rank=batch_size_per_feature_per_rank)
```
Relevant diffs:
D53866750
D55660277
D55660762

Reviewed By: sryap

Differential Revision: D56200676
@spcyppt spcyppt force-pushed the export-D56200676 branch from dee4542 to 6fc9692 Compare July 2, 2024 19:57
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D56200676

spcyppt added a commit to spcyppt/FBGEMM that referenced this pull request Jul 2, 2024
Summary:
Pull Request resolved: pytorch#2507

Enable Global weight decay for VBE
 ---
**Usage:**
set
```
optimizer = OptimType.EXACT_ROWWISE_ADAGRAD
weight_decay_mode = WeightDecayMode.DECOUPLE_GLOBAL

#  for VBE, pass batch_size_per_feature_per_rank
# Example: num_features = 2, num_ranks = 4
batch_size_per_feature_per_rank = [
    [1,  2, 8, 3] # batch sizes for [Rank 0, Rank 1, Rank 2, Rank 3] in Feature 0
    [6, 10, 3, 5] # batch sizes for [Rank 0, Rank 1, Rank 2, Rank 3] in Feature 1
]
```

e.g.,
```
tbe = SplitTableBatchedEmbeddingBagsCodegen(
            embedding_specs=[
                (E, D, managed_option, ComputeDevice.CUDA) for (E, D) in zip(Es, Ds)
            ],
            optimizer=OptimType.EXACT_ROWWISE_ADAGRAD,
            learning_rate=0.1,
            eps=0.1,
            output_dtype=output_dtype,
            pooling_mode=pooling_mode,
            weight_decay_mode=WeightDecayMode.DECOUPLE_GLOBAL,
        )
output = tbe(indices, offsets, batch_size_per_feature_per_rank=batch_size_per_feature_per_rank)
```
Relevant diffs:
D53866750
D55660277
D55660762

Reviewed By: sryap

Differential Revision: D56200676
@spcyppt spcyppt force-pushed the export-D56200676 branch from 6fc9692 to 35a7c04 Compare July 2, 2024 20:02
Summary:
Pull Request resolved: pytorch#2507

Enable Global weight decay for VBE
 ---
**Usage:**
set
```
optimizer = OptimType.EXACT_ROWWISE_ADAGRAD
weight_decay_mode = WeightDecayMode.DECOUPLE_GLOBAL

#  for VBE, pass batch_size_per_feature_per_rank
# Example: num_features = 2, num_ranks = 4
batch_size_per_feature_per_rank = [
    [1,  2, 8, 3] # batch sizes for [Rank 0, Rank 1, Rank 2, Rank 3] in Feature 0
    [6, 10, 3, 5] # batch sizes for [Rank 0, Rank 1, Rank 2, Rank 3] in Feature 1
]
```

e.g.,
```
tbe = SplitTableBatchedEmbeddingBagsCodegen(
            embedding_specs=[
                (E, D, managed_option, ComputeDevice.CUDA) for (E, D) in zip(Es, Ds)
            ],
            optimizer=OptimType.EXACT_ROWWISE_ADAGRAD,
            learning_rate=0.1,
            eps=0.1,
            output_dtype=output_dtype,
            pooling_mode=pooling_mode,
            weight_decay_mode=WeightDecayMode.DECOUPLE_GLOBAL,
        )
output = tbe(indices, offsets, batch_size_per_feature_per_rank=batch_size_per_feature_per_rank)
```
Relevant diffs:
D53866750
D55660277
D55660762

Reviewed By: sryap

Differential Revision: D56200676
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D56200676

@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request has been merged in 114bb0d.

spcyppt added a commit to spcyppt/FBGEMM that referenced this pull request Feb 26, 2026
Summary:
Pull Request resolved: pytorch#2507

Enable Global weight decay for VBE
 ---
**Usage:**
set
```
optimizer = OptimType.EXACT_ROWWISE_ADAGRAD
weight_decay_mode = WeightDecayMode.DECOUPLE_GLOBAL

#  for VBE, pass batch_size_per_feature_per_rank
# Example: num_features = 2, num_ranks = 4
batch_size_per_feature_per_rank = [
    [1,  2, 8, 3] # batch sizes for [Rank 0, Rank 1, Rank 2, Rank 3] in Feature 0
    [6, 10, 3, 5] # batch sizes for [Rank 0, Rank 1, Rank 2, Rank 3] in Feature 1
]
```

e.g.,
```
tbe = SplitTableBatchedEmbeddingBagsCodegen(
            embedding_specs=[
                (E, D, managed_option, ComputeDevice.CUDA) for (E, D) in zip(Es, Ds)
            ],
            optimizer=OptimType.EXACT_ROWWISE_ADAGRAD,
            learning_rate=0.1,
            eps=0.1,
            output_dtype=output_dtype,
            pooling_mode=pooling_mode,
            weight_decay_mode=WeightDecayMode.DECOUPLE_GLOBAL,
        )
output = tbe(indices, offsets, batch_size_per_feature_per_rank=batch_size_per_feature_per_rank)
```
Relevant diffs:
D53866750
D55660277
D55660762

Reviewed By: sryap

Differential Revision: D56200676
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants