Skip to content

Removed redundant default value initialization in benchmarking script #3130

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions torchrec/distributed/benchmark/benchmark_pipeline_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@

# pyre-strict

"""
Utilities for benchmarking training pipelines with different model configurations.

Adding New Model Support:
1. Create config class inheriting from BaseModelConfig with generate_model() method
2. Add the model to model_configs dict in create_model_config()
3. Add model-specific params to ModelSelectionConfig and create_model_config's arguments in benchmark_train_pipeline.py
"""

import copy
from abc import ABC, abstractmethod
from dataclasses import dataclass, fields
Expand Down Expand Up @@ -119,8 +128,8 @@ def generate_model(
class TestTowerSparseNNConfig(BaseModelConfig):
"""Configuration for TestTowerSparseNN model."""

embedding_groups: Optional[Dict[str, List[str]]] = None
feature_processor_modules: Optional[Dict[str, torch.nn.Module]] = None
embedding_groups: Optional[Dict[str, List[str]]]
feature_processor_modules: Optional[Dict[str, torch.nn.Module]]

def generate_model(
self,
Expand All @@ -143,8 +152,8 @@ def generate_model(
class TestTowerCollectionSparseNNConfig(BaseModelConfig):
"""Configuration for TestTowerCollectionSparseNN model."""

embedding_groups: Optional[Dict[str, List[str]]] = None
feature_processor_modules: Optional[Dict[str, torch.nn.Module]] = None
embedding_groups: Optional[Dict[str, List[str]]]
feature_processor_modules: Optional[Dict[str, torch.nn.Module]]

def generate_model(
self,
Expand Down
13 changes: 12 additions & 1 deletion torchrec/distributed/benchmark/benchmark_train_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,18 @@

# pyre-strict

#!/usr/bin/env python3
"""
Example usage:

Buck2 (internal):
buck2 run @fbcode//mode/opt fbcode//torchrec/distributed/benchmark:benchmark_train_pipeline -- --world_size=2 --pipeline=sparse --batch_size=10

OSS (external):
python -m torchrec.distributed.benchmark.benchmark_train_pipeline --world_size=4 --pipeline=sparse --batch_size=10

Adding New Model Support:
See benchmark_pipeline_utils.py for step-by-step instructions.
"""

from dataclasses import dataclass, field
from typing import Dict, List, Optional, Type, Union
Expand Down
Loading