Skip to content
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

Include SAM Fast in torch.compile nightly benchmark workflow #2856

Merged
merged 11 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/benchmark_torch_compile_nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
cd ..
pwd
rm -rf _tool
- name: Setup Python 3.8
- name: Setup Python 3.10
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: "3.10"
architecture: x64
- name: Setup Java 17
uses: actions/setup-java@v3
Expand All @@ -39,5 +39,9 @@ jobs:
sudo apt-get update -y
sudo apt-get install -y apache2-utils
pip install -r benchmarks/requirements-ab.txt
- name: Install model-specific dependencies
run: |
chmod +x benchmarks/benchmark_model_dependencies.sh
source benchmarks/benchmark_model_dependencies.sh
- name: Benchmark gpu nightly
run: python benchmarks/auto_benchmark.py --input benchmarks/benchmark_config_torch_compile_gpu.yaml --skip false --nightly True
1 change: 1 addition & 0 deletions benchmarks/benchmark_config_torch_compile_gpu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
models:
- "bert_torch_compile_gpu.yaml"
- "resnet50_torch_compile_gpu.yaml"
- "sam_fast_torch_compile_gpu.yaml"

# benchmark on "cpu" or "gpu".
# "cpu" is set if "hardware" is not specified
Expand Down
14 changes: 14 additions & 0 deletions benchmarks/benchmark_model_dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# Install dependencies and set environment variables for SAM Fast

# Install dependencies
pip install chardet
chmod +x examples/large_models/segment_anything_fast/install_segment_anything_fast.sh
source examples/large_models/segment_anything_fast/install_segment_anything_fast.sh

# Turn off A100G optimization
export SEGMENT_ANYTHING_FAST_USE_FLASH_4=0

echo "Installed dependencies and set environment variables for SAM Fast"

18 changes: 18 additions & 0 deletions benchmarks/models_config/sam_fast_torch_compile_gpu.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
sam_fast_vit_b:
process_batch_size_4:
benchmark_engine: "ab"
url: https://torchserve.pytorch.org/mar_files/sam-fast-vit-b-process-batch-size-4.tar.gz
agunapal marked this conversation as resolved.
Show resolved Hide resolved
workers:
- 4
batch_delay: 100
batch_size:
- 1
input: "./examples/large_models/segment_anything_fast/kitten.jpg"
requests: 1000
concurrency: 4
backend_profiling: False
exec_env: "local"
processors:
- "cpu"
- "gpus": "all"
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def initialize(self, ctx):
self.device = torch.device(
self.map_location + ":" + str(properties.get("gpu_id"))
)
torch.cuda.set_device(self.device)

model_type = ctx.model_yaml_config["handler"]["model_type"]
sam_checkpoint = ctx.model_yaml_config["handler"]["sam_checkpoint"]
Expand Down
Loading