Skip to content

Commit ed1a7b9

Browse files
larmeaarnphm
andauthored
feature(framework): diffusers (#3534)
Co-authored-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
1 parent 8d091c8 commit ed1a7b9

File tree

6 files changed

+592
-0
lines changed

6 files changed

+592
-0
lines changed

.github/workflows/frameworks.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
runs-on: ubuntu-latest
2424
outputs:
2525
catboost: ${{ steps.filter.outputs.catboost }}
26+
diffusers: ${{ steps.filter.outputs.diffusers }}
2627
fastai: ${{ steps.filter.outputs.fastai }}
2728
keras: ${{ steps.filter.outputs.keras }}
2829
lightgbm: ${{ steps.filter.outputs.lightgbm }}
@@ -56,6 +57,11 @@ jobs:
5657
- src/bentoml/catboost.py
5758
- src/bentoml/_internal/frameworks/catboost.py
5859
- tests/integration/frameworks/models/catboost.py
60+
diffusers:
61+
- *related
62+
- src/bentoml/diffusers.py
63+
- src/bentoml/_internal/frameworks/diffusers.py
64+
- tests/integration/frameworks/models/diffusers.py
5965
lightgbm:
6066
- *related
6167
- src/bentoml/lightgbm.py
@@ -173,6 +179,51 @@ jobs:
173179
files: ./coverage.xml
174180
token: ${{ secrets.CODECOV_TOKEN }}
175181

182+
diffusers_integration_tests:
183+
needs: diff
184+
if: ${{ (github.event_name == 'pull_request' && needs.diff.outputs.diffusers == 'true') || github.event_name == 'push' }}
185+
runs-on: ubuntu-latest
186+
steps:
187+
- uses: actions/checkout@v3
188+
with:
189+
fetch-depth: 0 # fetch all tags and branches
190+
- name: Setup python
191+
uses: actions/setup-python@v4
192+
with:
193+
python-version: 3.8
194+
195+
- name: Get pip cache dir
196+
id: cache-dir
197+
run: |
198+
echo ::set-output name=dir::$(pip cache dir)
199+
200+
- name: Cache pip dependencies
201+
uses: actions/cache@v3
202+
id: cache-pip
203+
with:
204+
path: ${{ steps.cache-dir.outputs.dir }}
205+
key: ${{ runner.os }}-tests-${{ hashFiles('requirements/tests-requirements.txt') }}
206+
207+
- name: Install dependencies
208+
run: |
209+
pip install .
210+
pip install diffusers torch transformers
211+
pip install -r requirements/tests-requirements.txt
212+
213+
- name: Run tests and generate coverage report
214+
run: |
215+
OPTS=(--cov-config pyproject.toml --cov src/bentoml --cov-append --framework diffusers)
216+
coverage run -m pytest tests/integration/frameworks/test_frameworks.py "${OPTS[@]}"
217+
218+
- name: Generate coverage
219+
run: coverage xml
220+
221+
- name: Upload test coverage to Codecov
222+
uses: codecov/codecov-action@v3
223+
with:
224+
files: ./coverage.xml
225+
token: ${{ secrets.CODECOV_TOKEN }}
226+
176227
fastai_integration_tests:
177228
needs: diff
178229
if: ${{ (github.event_name == 'pull_request' && needs.diff.outputs.fastai == 'true') || github.event_name == 'push' }}

requirements/frameworks-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ pytorch-lightning
1717
# huggingface dependencies
1818
transformers
1919
tokenizer
20+
diffusers

src/bentoml/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
from . import lightgbm
6969
from . import onnxmlir
7070
from . import detectron
71+
from . import diffusers
7172
from . import tensorflow
7273
from . import statsmodels
7374
from . import torchscript
@@ -91,6 +92,7 @@
9192

9293
catboost = _LazyLoader("bentoml.catboost", globals(), "bentoml.catboost")
9394
detectron = _LazyLoader("bentoml.detectron", globals(), "bentoml.detectron")
95+
diffusers = _LazyLoader("bentoml.diffusers", globals(), "bentoml.diffusers")
9496
easyocr = _LazyLoader("bentoml.easyocr", globals(), "bentoml.easyocr")
9597
flax = _LazyLoader("bentoml.flax", globals(), "bentoml.flax")
9698
fastai = _LazyLoader("bentoml.fastai", globals(), "bentoml.fastai")
@@ -166,6 +168,7 @@
166168
# Framework specific modules
167169
"catboost",
168170
"detectron",
171+
"diffusers",
169172
"easyocr",
170173
"flax",
171174
"fastai",

0 commit comments

Comments
 (0)