Skip to content

Commit

Permalink
Merge branch 'main' into yutji/directx-docker-build
Browse files Browse the repository at this point in the history
  • Loading branch information
yukirora committed Jun 28, 2023
2 parents c5a3adc + bbb0e24 commit ab94da1
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 9 deletions.
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
try:
pkg_resources.require(['pip>=18', 'setuptools>=45, <66'])
except (pkg_resources.VersionConflict, pkg_resources.DistributionNotFound):
print('Try update pip/setuptools versions, for example, python3 -m pip install --upgrade pip setuptools==65.7')
print(
'\033[93mTry update pip/setuptools versions, for example, '
'python3 -m pip install --upgrade pip wheel setuptools==65.7\033[0m'
)
raise

here = pathlib.Path(__file__).parent.resolve()
Expand Down
1 change: 1 addition & 0 deletions superbench/benchmarks/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class Platform(Enum):
CPU = 'CPU'
CUDA = 'CUDA'
ROCM = 'ROCm'
DIRECTX = 'DirectX'


class Framework(Enum):
Expand Down
6 changes: 3 additions & 3 deletions superbench/benchmarks/model_benchmarks/pytorch_bert.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def __init__(self, name, parameters=''):
def add_parser_arguments(self):
"""Add the BERT-specified arguments.
BERT model reference: https://huggingface.co/transformers/model_doc/bert.html
BERT model reference: https://huggingface.co/docs/transformers/model_doc/bert
"""
super().add_parser_arguments()

Expand Down Expand Up @@ -227,15 +227,15 @@ def _inference_step(self, precision):


# Register BERT Large benchmark.
# Reference: https://huggingface.co/transformers/pretrained_models.html
# Reference: https://huggingface.co/transformers/v3.3.1/pretrained_models.html
BenchmarkRegistry.register_benchmark(
'pytorch-bert-large',
PytorchBERT,
parameters='--hidden_size=1024 --num_hidden_layers=24 --num_attention_heads=16 --intermediate_size=4096'
)

# Register BERT Base benchmark.
# Reference: https://huggingface.co/transformers/pretrained_models.html
# Reference: https://huggingface.co/transformers/v3.3.1/pretrained_models.html
BenchmarkRegistry.register_benchmark(
'pytorch-bert-base',
PytorchBERT,
Expand Down
10 changes: 5 additions & 5 deletions superbench/benchmarks/model_benchmarks/pytorch_gpt2.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def __init__(self, name, parameters=''):
def add_parser_arguments(self):
"""Add the GPT2-specified arguments.
GPT2 model reference: https://huggingface.co/transformers/model_doc/gpt2.html
GPT2 model reference: https://huggingface.co/docs/transformers/model_doc/gpt2
"""
super().add_parser_arguments()

Expand Down Expand Up @@ -221,25 +221,25 @@ def _inference_step(self, precision):


# Register GPT2 benchmark with 117M parameters.
# Reference: https://huggingface.co/transformers/pretrained_models.html
# Reference: https://huggingface.co/transformers/v3.3.1/pretrained_models.html
BenchmarkRegistry.register_benchmark(
'pytorch-gpt2-small', PytorchGPT2, parameters='--hidden_size=768 --num_hidden_layers=12 --num_attention_heads=12'
)

# Register GPT2 benchmark with 345M parameters.
# Reference: https://huggingface.co/transformers/pretrained_models.html
# Reference: https://huggingface.co/transformers/v3.3.1/pretrained_models.html
BenchmarkRegistry.register_benchmark(
'pytorch-gpt2-medium', PytorchGPT2, parameters='--hidden_size=1024 --num_hidden_layers=24 --num_attention_heads=16'
)

# Register GPT2 benchmark with 774M parameters.
# Reference: https://huggingface.co/transformers/pretrained_models.html
# Reference: https://huggingface.co/transformers/v3.3.1/pretrained_models.html
BenchmarkRegistry.register_benchmark(
'pytorch-gpt2-large', PytorchGPT2, parameters='--hidden_size=1280 --num_hidden_layers=36 --num_attention_heads=20'
)

# Register GPT2 benchmark with 1558M parameters.
# Reference: https://huggingface.co/transformers/pretrained_models.html
# Reference: https://huggingface.co/transformers/v3.3.1/pretrained_models.html
BenchmarkRegistry.register_benchmark(
'pytorch-gpt2-xl', PytorchGPT2, parameters='--hidden_size=1600 --num_hidden_layers=48 --num_attention_heads=25'
)
4 changes: 4 additions & 0 deletions superbench/common/devices/gpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ def get_vendor(self):
if not list(Path('/dev/dri').glob('card*')):
logger.warning('Cannot find AMD GPU device.')
return 'amd'
if list(Path(r'C:\Windows\System32').glob('*DriverStore/FileRepository/nv*.inf_amd64_*/nvapi64.dll')):
return 'nvidia-graphics'
if list(Path(r'C:\Windows\System32').glob('*DriverStore/FileRepository/u*.inf_amd64_*/*/aticfx64.dll')):
return 'amd-graphics'
return None

@property
Expand Down
2 changes: 2 additions & 0 deletions superbench/executor/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ def __get_platform(self):
return Platform.CUDA
elif gpu.vendor == 'amd':
return Platform.ROCM
elif gpu.vendor == 'amd-graphics' or gpu.vendor == 'nvidia-graphics':
return Platform.DIRECTX
except Exception as e:
logger.error(e)
return Platform.CPU
Expand Down

0 comments on commit ab94da1

Please sign in to comment.