-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/huggingface/optimum-benchmark…
… into main
- Loading branch information
Showing
30 changed files
with
473 additions
and
239 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
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
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
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
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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
log_report: true | ||
print_report: true | ||
|
||
# hydra/cli specific settings | ||
hydra: | ||
run: | ||
|
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 |
---|---|---|
@@ -1,23 +1,45 @@ | ||
import os | ||
|
||
from huggingface_hub import whoami | ||
|
||
from optimum_benchmark import Benchmark, BenchmarkConfig, InferenceConfig, ProcessConfig, PyTorchConfig | ||
from optimum_benchmark.logging_utils import setup_logging | ||
|
||
setup_logging(level="INFO", prefix="MAIN-PROCESS") | ||
try: | ||
USERNAME = whoami()["name"] | ||
except Exception as e: | ||
print(f"Failed to get username from Hugging Face Hub: {e}") | ||
USERNAME = None | ||
|
||
if __name__ == "__main__": | ||
BENCHMARK_NAME = "pytorch_bert" | ||
REPO_ID = f"IlyasMoutawwakil/{BENCHMARK_NAME}" | ||
BENCHMARK_NAME = "pytorch_bert" | ||
|
||
|
||
def run_benchmark(): | ||
launcher_config = ProcessConfig(device_isolation=True, device_isolation_action="warn") | ||
backend_config = PyTorchConfig(device="cuda", device_ids="0", no_weights=True, model="bert-base-uncased") | ||
scenario_config = InferenceConfig(memory=True, latency=True, input_shapes={"batch_size": 1, "sequence_length": 128}) | ||
|
||
benchmark_config = BenchmarkConfig( | ||
name=BENCHMARK_NAME, launcher=launcher_config, backend=backend_config, scenario=scenario_config | ||
name=BENCHMARK_NAME, | ||
launcher=launcher_config, | ||
scenario=scenario_config, | ||
backend=backend_config, | ||
print_report=True, | ||
log_report=True, | ||
) | ||
# benchmark_config.push_to_hub(repo_id=REPO_ID) | ||
|
||
benchmark_report = Benchmark.launch(benchmark_config) | ||
# benchmark_report.push_to_hub(repo_id=REPO_ID) | ||
|
||
return benchmark_config, benchmark_report | ||
|
||
|
||
if __name__ == "__main__": | ||
level = os.environ.get("LOG_LEVEL", "INFO") | ||
to_file = os.environ.get("LOG_TO_FILE", "0") == "1" | ||
setup_logging(level=level, to_file=to_file, prefix="MAIN-PROCESS") | ||
|
||
benchmark_config, benchmark_report = run_benchmark() | ||
benchmark = Benchmark(config=benchmark_config, report=benchmark_report) | ||
# benchmark.push_to_hub(repo_id=REPO_ID) | ||
|
||
if USERNAME is not None: | ||
benchmark_config.push_to_hub(repo_id=f"{USERNAME}/benchmarks", subfolder=BENCHMARK_NAME) | ||
benchmark_report.push_to_hub(repo_id=f"{USERNAME}/benchmarks", subfolder=BENCHMARK_NAME) | ||
benchmark.push_to_hub(repo_id=f"{USERNAME}/benchmarks", subfolder=BENCHMARK_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
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
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
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
Oops, something went wrong.