-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add moondream and llava from huggingface transformers (#2176)
Summary: For llava model: * The CPU accuracy test fail because of CI runner CPU memory OOM * The GPU accuracy test fail because of GPU CUDA OOM Pull Request resolved: #2176 Reviewed By: aaronenyeshi Differential Revision: D54075890 Pulled By: xuzhao9 fbshipit-source-id: 99a256616c228303e366734d3f33bcf2b63933a6
- Loading branch information
1 parent
25338db
commit 4c7b6ec
Showing
10 changed files
with
105 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from torchbenchmark.tasks import NLP | ||
from torchbenchmark.util.framework.huggingface.model_factory import HuggingFaceModel | ||
|
||
class Model(HuggingFaceModel): | ||
task = NLP.LANGUAGE_MODELING | ||
# DEFAULT_TRAIN_BSIZE not specified since we're not implementing a train test | ||
# DEFAULT_TRAIN_BSIZE = 1 | ||
DEFAULT_EVAL_BSIZE = 1 | ||
|
||
def __init__(self, test, device, batch_size=None, extra_args=[]): | ||
super().__init__(name="llava", test=test, device=device, batch_size=batch_size, extra_args=extra_args) | ||
|
||
def train(self): | ||
return NotImplementedError("Not implemented") | ||
|
||
def eval(self): | ||
super().eval() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
devices: | ||
NVIDIA A100-SXM4-40GB: | ||
eval_batch_size: 1 | ||
eval_benchmark: false | ||
eval_deterministic: false | ||
eval_nograd: true | ||
train_benchmark: false | ||
train_deterministic: false | ||
not_implemented: | ||
- device: NVIDIA A10G | ||
# CPU OOM on the CI runner | ||
- device: cpu | ||
# accuracy test OOM on CUDA | ||
- device: cuda | ||
test: example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
einops |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from torchbenchmark.tasks import NLP | ||
from torchbenchmark.util.framework.huggingface.model_factory import HuggingFaceModel | ||
|
||
class Model(HuggingFaceModel): | ||
task = NLP.LANGUAGE_MODELING | ||
# DEFAULT_TRAIN_BSIZE not specified since we're not implementing a train test | ||
# DEFAULT_TRAIN_BSIZE = 1 | ||
DEFAULT_EVAL_BSIZE = 1 | ||
|
||
def __init__(self, test, device, batch_size=None, extra_args=[]): | ||
super().__init__(name="moondream", test=test, device=device, batch_size=batch_size, extra_args=extra_args) | ||
|
||
def train(self): | ||
return NotImplementedError("Not implemented") | ||
|
||
def eval(self): | ||
super().eval() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
devices: | ||
NVIDIA A100-SXM4-40GB: | ||
eval_batch_size: 1 | ||
eval_benchmark: false | ||
eval_deterministic: false | ||
eval_nograd: true | ||
train_benchmark: false | ||
train_deterministic: false | ||
not_implemented: | ||
- device: NVIDIA A10G |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
einops |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters