-
Notifications
You must be signed in to change notification settings - Fork 278
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
Added Whisper from Huggingface. #1769
Changes from 3 commits
89f4497
ba57c50
bb3f331
116df9c
c77ad90
c7ef8a3
f232aac
c3d5d10
9bca12c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from torchbenchmark.util.framework.huggingface.model_factory import HuggingFaceModel | ||
from torchbenchmark.tasks import SPEECH | ||
import torch | ||
|
||
class Model(HuggingFaceModel): | ||
task = SPEECH.RECOGNITION | ||
# https://cdn.openai.com/papers/whisper.pdf Says for large-v2 they trained on 1024 batch sizes, with 16 GPUs | ||
DEFAULT_EVAL_BSIZE = 64 | ||
DEFAULT_Train_BSIZE = 64 | ||
|
||
def __init__(self, test, device, jit=False, batch_size=None, extra_args=[]): | ||
super().__init__(name="hf_Whisper", test=test, device=device, jit=jit, batch_size=batch_size, extra_args=extra_args) | ||
self.feature_size = 80 | ||
self.sequence_length = 3000 | ||
input_features = torch.randn(size=(self.batch_size, self.feature_size, self.sequence_length),device=self.device) | ||
self.example_inputs = {"input_features": input_features.to(self.device)} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we are wrapping the model in a different way, we need to implement customized The reason we need |
||
|
||
xuzhao9 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
def eval(self): | ||
super().eval() | ||
def train(self): | ||
raise NotImplementedError("Training is not implemented.") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
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) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
devices: | ||
NVIDIA A100-SXM4-40GB: | ||
eval_batch_size: 8 | ||
eval_benchmark: false | ||
eval_deterministic: false | ||
eval_nograd: true | ||
not_implemented: | ||
- jit: true | ||
train_benchmark: false | ||
train_deterministic: false |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
numba |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If training is not implemented, please remove this line.