optimum-habana
optimum-habana copied to clipboard
Add an example of Segment Anything Model [Inference]
What does this PR do?
Add an example code of SegmentAnythingModel using Graph mode and BF16.
Original FP32: n_iterations: 20 Total latency (ms): 10380.430936813354 Average latency (ms): 519.0215468406677
Enabled graph mode and BF16: n_iterations: 20 Total latency (ms): 1639.5680904388428 Average latency (ms): 81.97840452194214
Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [ ] Did you make sure to update the documentation with your changes?
- [ ] Did you write any new necessary tests?
@regisss This is a validated model and this is an example script for users. No core code has been changed.
@cfgfung Can you please provide GPU benchmark and add ci tests?
@cfgfung Can you please provide GPU benchmark and add ci tests?
@yeonsily
Sure. Is there any reference for the CI test? This is just a validated example. I checked another merged example (https://github.com/huggingface/optimum-habana/commit/2f55de3f9ad23a853768c16029c455ee11b0e515) and that does not require CI.
GPU Benchmark: A100-80GB , CUDA12.2, Driver Version: 535.54.03 With BF16 Autocast: n_iterations: 20 Total latency (ms): 2248.983144760132 Average latency (ms): 112.44915723800659
@cfgfung Your code looks good. Can you just modify your test file name to something like test_image_segementation.py . Also, please make sure your test runs on CI test. https://github.com/huggingface/optimum-habana/blob/8786b7592c58d394f9460710415de3c08775b1b6/Makefile#L45
@cfgfung Your code looks good. Can you just modify your test file name to something like test_image_segementation.py . Also, please make sure your test runs on CI test.
https://github.com/huggingface/optimum-habana/blob/8786b7592c58d394f9460710415de3c08775b1b6/Makefile#L45
Thanks for the review. I have renamed the test file and add few lines of codes to the makefile for the CI tests.
Could you delete old file : test_modelenabling.py?
Also I ran your tests on the latest, and I'm getting this error on the last test. Do you see this passing on Docker 1.15.0? tests/test_image_segmentation.py::GaudiSAMTester::test_inference_default PASSED tests/test_image_segmentation.py::GaudiSAMTester::test_inference_hpu_graphs PASSED tests/test_image_segmentation.py::GaudiSAMTester::test_no_latency_regression_bf16 FAILED
FAILED tests/test_image_segmentation.py::GaudiSAMTester::test_no_latency_regression_bf16 - AssertionError: 81.58655166625977 not greater than or equal to 93.97604942321777
Could you delete old file : test_modelenabling.py?
Also I ran your tests on the latest, and I'm getting this error on the last test. Do you see this passing on Docker 1.15.0? tests/test_image_segmentation.py::GaudiSAMTester::test_inference_default PASSED tests/test_image_segmentation.py::GaudiSAMTester::test_inference_hpu_graphs PASSED tests/test_image_segmentation.py::GaudiSAMTester::test_no_latency_regression_bf16 FAILED
FAILED tests/test_image_segmentation.py::GaudiSAMTester::test_no_latency_regression_bf16 - AssertionError: 81.58655166625977 not greater than or equal to 93.97604942321777
Removed the file. Somehow it passed on my side. I fixed the logic of that test. It should be able to pass now.
@cfgfung can you merge your change to the latest baseline?
@cfgfung can you merge your change to the latest baseline?
Hi,
I have applied a git rebase
. It should be aligned with the latest baseline.
@cfgfung can you rebase and provide the test result on latest?
@cfgfung can you rebase and provide the test result on latest?
Hi,
I have applied rebase and ran the tests.
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.