diff --git a/torchbenchmark/models/hf_Roberta_base/__init__.py b/torchbenchmark/models/hf_Roberta_base/__init__.py new file mode 100644 index 0000000000..a1f5ae872e --- /dev/null +++ b/torchbenchmark/models/hf_Roberta_base/__init__.py @@ -0,0 +1,10 @@ +from torchbenchmark.tasks import NLP +from torchbenchmark.util.framework.huggingface.model_factory import HuggingFaceModel + +class Model(HuggingFaceModel): + task = NLP.LANGUAGE_MODELING + DEFAULT_TRAIN_BSIZE = 4 + DEFAULT_EVAL_BSIZE = 1 + + def __init__(self, test, device, batch_size=None, extra_args=[]): + super().__init__(name="hf_Roberta_base", test=test, device=device, batch_size=batch_size, extra_args=extra_args) diff --git a/torchbenchmark/models/hf_Roberta_base/install.py b/torchbenchmark/models/hf_Roberta_base/install.py new file mode 100644 index 0000000000..c7855f3fef --- /dev/null +++ b/torchbenchmark/models/hf_Roberta_base/install.py @@ -0,0 +1,14 @@ + +import subprocess +import sys +import os +from torchbenchmark.util.framework.huggingface.patch_hf import patch_transformers, cache_model + +def pip_install_requirements(): + subprocess.check_call([sys.executable, '-m', 'pip', 'install', '-q', '-r', 'requirements.txt']) + +if __name__ == '__main__': + pip_install_requirements() + patch_transformers() + model_name = os.path.basename(os.path.dirname(os.path.abspath(__file__))) + cache_model(model_name) diff --git a/torchbenchmark/models/hf_Roberta_base/metadata.yaml b/torchbenchmark/models/hf_Roberta_base/metadata.yaml new file mode 100644 index 0000000000..836832d61d --- /dev/null +++ b/torchbenchmark/models/hf_Roberta_base/metadata.yaml @@ -0,0 +1,8 @@ +devices: + NVIDIA A100-SXM4-40GB: + eval_batch_size: 8 +eval_benchmark: false +eval_deterministic: false +eval_nograd: true +train_benchmark: false +train_deterministic: false diff --git a/torchbenchmark/models/hf_Roberta_base/requirements.txt b/torchbenchmark/models/hf_Roberta_base/requirements.txt new file mode 100644 index 0000000000..8e54d540dd --- /dev/null +++ b/torchbenchmark/models/hf_Roberta_base/requirements.txt @@ -0,0 +1,2 @@ +sentencepiece +datasets diff --git a/torchbenchmark/util/framework/huggingface/basic_configs.py b/torchbenchmark/util/framework/huggingface/basic_configs.py index 06ebaed720..72f067af69 100644 --- a/torchbenchmark/util/framework/huggingface/basic_configs.py +++ b/torchbenchmark/util/framework/huggingface/basic_configs.py @@ -74,6 +74,12 @@ "AutoModelForMaskedLM", ), "hf_Bert": (512, 512, "BertConfig()", "AutoModelForMaskedLM"), + "hf_Roberta_base": ( + 512, + 512, + 'AutoConfig.from_pretrained("xlm-roberta-base")', + "AutoModelForMaskedLM", + ), # see https://huggingface.co/bert-large-cased "hf_Bert_large": ( 512,