Skip to content

Add StableDiffusion3 #1820

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

Merged
merged 62 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from 53 commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
b681ea3
Add VGG16 backbone (#1737)
divyashreepathihalli Aug 8, 2024
33854c6
Add `ResNetBackbone` and `ResNetImageClassifier` (#1765)
james77777778 Aug 12, 2024
dd8df26
Add CSP DarkNet backbone and classifier (#1774)
sachinprasadhs Aug 15, 2024
7381b6d
Add `FeaturePyramidBackbone` and port weights from `timm` for `ResNet…
james77777778 Aug 15, 2024
b76317e
Add DenseNet (#1775)
sachinprasadhs Aug 16, 2024
c822f3a
Add ViTDetBackbone (#1776)
divyashreepathihalli Aug 20, 2024
bc69acd
Add Mix transformer (#1780)
sachinprasadhs Aug 20, 2024
7e180c2
update input_image_shape -> image_shape (#1785)
divyashreepathihalli Aug 21, 2024
12a4ccc
Create __init__.py (#1788)
sachinprasadhs Aug 22, 2024
3e9aaba
Hack package build script to rename to keras-hub (#1793)
mattdangerw Aug 26, 2024
741f98d
Add CLIP and T5XXL for StableDiffusionV3 (#1790)
james77777778 Aug 26, 2024
352e0b7
Add Bounding Box Utils (#1791)
sineeli Aug 28, 2024
1a81234
mobilenet_v3 added in keras-nlp (#1782)
ushareng Aug 28, 2024
894226d
Pkgoogle/efficient net migration (#1778)
pkgoogle Aug 28, 2024
6104520
Add the ResNet_vd backbone (#1766)
gowthamkpr Aug 28, 2024
faffd86
Add `VAEImageDecoder` for StableDiffusionV3 (#1796)
james77777778 Aug 28, 2024
bdf0d7f
Replace `Backbone` with `keras.Model` in `CLIPTextEncoder` and `T5XXL…
james77777778 Aug 28, 2024
85daf81
Add pyramid output for densenet, cspDarknet (#1801)
sachinprasadhs Sep 3, 2024
321b757
Add `MMDiT` for StableDiffusionV3 (#1806)
james77777778 Sep 4, 2024
dfb7123
Add remaining bbox utils (#1804)
sineeli Sep 4, 2024
753047d
Fix timm conversion for rersnet (#1814)
sachinprasadhs Sep 5, 2024
3c239ca
Add `StableDiffusion3`
james77777778 Sep 11, 2024
53e90f1
Fix `_normalize_inputs`
james77777778 Sep 11, 2024
6503f66
Separate CLIP encoders from SD3 backbone.
james77777778 Sep 12, 2024
86f98bb
Simplify `text_to_image` function.
james77777778 Sep 12, 2024
4ad8d47
Address comments
james77777778 Sep 13, 2024
0d6d6a1
Minor update and add docstrings.
james77777778 Sep 13, 2024
edc74fa
Add VGG16 backbone (#1737)
divyashreepathihalli Aug 8, 2024
f305f64
Add `ResNetBackbone` and `ResNetImageClassifier` (#1765)
james77777778 Aug 12, 2024
d090b98
Add CSP DarkNet backbone and classifier (#1774)
sachinprasadhs Aug 15, 2024
4b20620
Add `FeaturePyramidBackbone` and port weights from `timm` for `ResNet…
james77777778 Aug 15, 2024
689a8db
Add DenseNet (#1775)
sachinprasadhs Aug 16, 2024
3f6c936
Add ViTDetBackbone (#1776)
divyashreepathihalli Aug 20, 2024
76d704f
Add Mix transformer (#1780)
sachinprasadhs Aug 20, 2024
d91b61a
update input_image_shape -> image_shape (#1785)
divyashreepathihalli Aug 21, 2024
ab7efdd
Create __init__.py (#1788)
sachinprasadhs Aug 22, 2024
2a11cf1
Hack package build script to rename to keras-hub (#1793)
mattdangerw Aug 26, 2024
40b5153
Add CLIP and T5XXL for StableDiffusionV3 (#1790)
james77777778 Aug 26, 2024
f597523
Add Bounding Box Utils (#1791)
sineeli Aug 28, 2024
1e97bae
mobilenet_v3 added in keras-nlp (#1782)
ushareng Aug 28, 2024
639d983
Pkgoogle/efficient net migration (#1778)
pkgoogle Aug 28, 2024
b10c410
Add the ResNet_vd backbone (#1766)
gowthamkpr Aug 28, 2024
9feb2d8
Add `VAEImageDecoder` for StableDiffusionV3 (#1796)
james77777778 Aug 28, 2024
30cc165
Replace `Backbone` with `keras.Model` in `CLIPTextEncoder` and `T5XXL…
james77777778 Aug 28, 2024
ae3d558
Add pyramid output for densenet, cspDarknet (#1801)
sachinprasadhs Sep 3, 2024
76e8fb6
Add `MMDiT` for StableDiffusionV3 (#1806)
james77777778 Sep 4, 2024
759905e
Add remaining bbox utils (#1804)
sineeli Sep 4, 2024
a5e5d8f
Fix timm conversion for rersnet (#1814)
sachinprasadhs Sep 5, 2024
f76b689
Merge remote-tracking branch 'upstream/keras-hub' into add-sd3
james77777778 Sep 15, 2024
ec7f53d
Fix
james77777778 Sep 15, 2024
ab10eaa
Update
james77777778 Sep 15, 2024
79f3a01
Rename to diffuser and decoder
james77777778 Sep 15, 2024
fb73693
Define functional model
james77777778 Sep 16, 2024
aa42194
Merge remote-tracking branch 'upstream/master' into add-sd3
james77777778 Sep 23, 2024
403e4b8
Merge from upstream/master
james77777778 Sep 23, 2024
1363024
Delete old SD3
james77777778 Sep 23, 2024
51ca7ea
Fix copyright
james77777778 Sep 23, 2024
0f72e58
Rename to keras_hub
james77777778 Sep 23, 2024
ef425d0
Address comments
james77777778 Sep 24, 2024
74a4b07
Update
james77777778 Sep 24, 2024
2fb4953
Fix CI
james77777778 Sep 24, 2024
6e086cf
Fix bugs occurred in keras3.1
james77777778 Sep 25, 2024
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
43 changes: 43 additions & 0 deletions .github/workflows/publish-hub-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Publish Hub to PyPI

on:
push:
branches:
- keras-hub

permissions:
contents: read

jobs:
build-and-publish:
name: Build and publish Hub to PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Get pip cache dir
id: pip-cache
run: |
python -m pip install --upgrade pip setuptools
echo "::set-output name=dir::$(pip cache dir)"
- name: pip cache
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip install -r requirements.txt --progress-bar off
- name: Build a binary wheel and a source tarball
run: >-
python pip_build.py
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN_HUB }}
1 change: 1 addition & 0 deletions keras_nlp/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
since your modifications would be overwritten.
"""

from keras_nlp.api import bounding_box
from keras_nlp.api import layers
from keras_nlp.api import metrics
from keras_nlp.api import models
Expand Down
36 changes: 36 additions & 0 deletions keras_nlp/api/bounding_box/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright 2024 The KerasNLP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""DO NOT EDIT.

This file was autogenerated. Do not edit it by hand,
since your modifications would be overwritten.
"""

from keras_nlp.src.bounding_box.converters import convert_format
from keras_nlp.src.bounding_box.formats import CENTER_XYWH
from keras_nlp.src.bounding_box.formats import REL_XYWH
from keras_nlp.src.bounding_box.formats import REL_XYXY
from keras_nlp.src.bounding_box.formats import REL_YXYX
from keras_nlp.src.bounding_box.formats import XYWH
from keras_nlp.src.bounding_box.formats import XYXY
from keras_nlp.src.bounding_box.formats import YXYX
from keras_nlp.src.bounding_box.iou import compute_ciou
from keras_nlp.src.bounding_box.iou import compute_iou
from keras_nlp.src.bounding_box.to_dense import to_dense
from keras_nlp.src.bounding_box.to_ragged import to_ragged
from keras_nlp.src.bounding_box.utils import as_relative
from keras_nlp.src.bounding_box.utils import clip_boxes
from keras_nlp.src.bounding_box.utils import clip_to_image
from keras_nlp.src.bounding_box.utils import is_relative
from keras_nlp.src.bounding_box.validate_format import validate_format
45 changes: 45 additions & 0 deletions keras_nlp/api/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@
from keras_nlp.src.models.bloom.bloom_tokenizer import BloomTokenizer
from keras_nlp.src.models.causal_lm import CausalLM
from keras_nlp.src.models.causal_lm_preprocessor import CausalLMPreprocessor
from keras_nlp.src.models.clip.clip_preprocessor import CLIPPreprocessor
from keras_nlp.src.models.clip.clip_tokenizer import CLIPTokenizer
from keras_nlp.src.models.csp_darknet.csp_darknet_backbone import (
CSPDarkNetBackbone,
)
from keras_nlp.src.models.csp_darknet.csp_darknet_image_classifier import (
CSPDarkNetImageClassifier,
)
from keras_nlp.src.models.deberta_v3.deberta_v3_backbone import (
DebertaV3Backbone,
)
Expand All @@ -90,6 +98,10 @@
from keras_nlp.src.models.deberta_v3.deberta_v3_tokenizer import (
DebertaV3Tokenizer,
)
from keras_nlp.src.models.densenet.densenet_backbone import DenseNetBackbone
from keras_nlp.src.models.densenet.densenet_image_classifier import (
DenseNetImageClassifier,
)
from keras_nlp.src.models.distil_bert.distil_bert_backbone import (
DistilBertBackbone,
)
Expand All @@ -114,6 +126,9 @@
from keras_nlp.src.models.distil_bert.distil_bert_tokenizer import (
DistilBertTokenizer,
)
from keras_nlp.src.models.efficientnet.efficientnet_backbone import (
EfficientNetBackbone,
)
from keras_nlp.src.models.electra.electra_backbone import ElectraBackbone
from keras_nlp.src.models.electra.electra_tokenizer import ElectraTokenizer
from keras_nlp.src.models.f_net.f_net_backbone import FNetBackbone
Expand All @@ -138,6 +153,7 @@
FalconCausalLMPreprocessor,
)
from keras_nlp.src.models.falcon.falcon_tokenizer import FalconTokenizer
from keras_nlp.src.models.feature_pyramid_backbone import FeaturePyramidBackbone
from keras_nlp.src.models.gemma.gemma_backbone import GemmaBackbone
from keras_nlp.src.models.gemma.gemma_causal_lm import GemmaCausalLM
from keras_nlp.src.models.gemma.gemma_causal_lm_preprocessor import (
Expand All @@ -157,6 +173,7 @@
GPTNeoXCausalLMPreprocessor,
)
from keras_nlp.src.models.gpt_neo_x.gpt_neo_x_tokenizer import GPTNeoXTokenizer
from keras_nlp.src.models.image_classifier import ImageClassifier
from keras_nlp.src.models.llama3.llama3_backbone import Llama3Backbone
from keras_nlp.src.models.llama3.llama3_causal_lm import Llama3CausalLM
from keras_nlp.src.models.llama3.llama3_causal_lm_preprocessor import (
Expand All @@ -177,6 +194,16 @@
MistralCausalLMPreprocessor,
)
from keras_nlp.src.models.mistral.mistral_tokenizer import MistralTokenizer
from keras_nlp.src.models.mix_transformer.mix_transformer_backbone import (
MiTBackbone,
)
from keras_nlp.src.models.mix_transformer.mix_transformer_classifier import (
MiTImageClassifier,
)
from keras_nlp.src.models.mobilenet.mobilenet_backbone import MobileNetBackbone
from keras_nlp.src.models.mobilenet.mobilenet_image_classifier import (
MobileNetImageClassifier,
)
from keras_nlp.src.models.opt.opt_backbone import OPTBackbone
from keras_nlp.src.models.opt.opt_causal_lm import OPTCausalLM
from keras_nlp.src.models.opt.opt_causal_lm_preprocessor import (
Expand All @@ -202,6 +229,10 @@
)
from keras_nlp.src.models.phi3.phi3_tokenizer import Phi3Tokenizer
from keras_nlp.src.models.preprocessor import Preprocessor
from keras_nlp.src.models.resnet.resnet_backbone import ResNetBackbone
from keras_nlp.src.models.resnet.resnet_image_classifier import (
ResNetImageClassifier,
)
from keras_nlp.src.models.roberta.roberta_backbone import RobertaBackbone
from keras_nlp.src.models.roberta.roberta_masked_lm import RobertaMaskedLM
from keras_nlp.src.models.roberta.roberta_masked_lm_preprocessor import (
Expand All @@ -222,14 +253,28 @@
from keras_nlp.src.models.roberta.roberta_tokenizer import RobertaTokenizer
from keras_nlp.src.models.seq_2_seq_lm import Seq2SeqLM
from keras_nlp.src.models.seq_2_seq_lm_preprocessor import Seq2SeqLMPreprocessor
from keras_nlp.src.models.stable_diffusion_3.stable_diffusion_3_backbone import (
StableDiffusion3Backbone,
)
from keras_nlp.src.models.stable_diffusion_3.stable_diffusion_3_text_to_image import (
StableDiffusion3TextToImage,
)
from keras_nlp.src.models.stable_diffusion_3.stable_diffusion_3_text_to_image_preprocessor import (
StableDiffusion3TextToImagePreprocessor,
)
from keras_nlp.src.models.t5.t5_backbone import T5Backbone
from keras_nlp.src.models.t5.t5_preprocessor import T5Preprocessor
from keras_nlp.src.models.t5.t5_tokenizer import T5Tokenizer
from keras_nlp.src.models.task import Task
from keras_nlp.src.models.text_classifier import TextClassifier
from keras_nlp.src.models.text_classifier import TextClassifier as Classifier
from keras_nlp.src.models.text_classifier_preprocessor import (
TextClassifierPreprocessor,
)
from keras_nlp.src.models.text_to_image import TextToImage
from keras_nlp.src.models.vgg.vgg_backbone import VGGBackbone
from keras_nlp.src.models.vgg.vgg_image_classifier import VGGImageClassifier
from keras_nlp.src.models.vit_det.vit_det_backbone import ViTDetBackbone
from keras_nlp.src.models.whisper.whisper_backbone import WhisperBackbone
from keras_nlp.src.models.whisper.whisper_tokenizer import WhisperTokenizer
from keras_nlp.src.models.xlm_roberta.xlm_roberta_backbone import (
Expand Down
1 change: 1 addition & 0 deletions keras_nlp/api/tokenizers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from keras_nlp.src.models.bart.bart_tokenizer import BartTokenizer
from keras_nlp.src.models.bert.bert_tokenizer import BertTokenizer
from keras_nlp.src.models.bloom.bloom_tokenizer import BloomTokenizer
from keras_nlp.src.models.clip.clip_tokenizer import CLIPTokenizer
from keras_nlp.src.models.deberta_v3.deberta_v3_tokenizer import (
DebertaV3Tokenizer,
)
Expand Down
5 changes: 5 additions & 0 deletions keras_nlp/src/api_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@

def maybe_register_serializable(symbol):
if isinstance(symbol, types.FunctionType) or hasattr(symbol, "get_config"):
# We register twice, first with the old name, second with the new name,
# so loading still works under the old name.
# TODO replace compat_package_name with keras-nlp after rename.
compat_name = "compat_package_name"
keras.saving.register_keras_serializable(package=compat_name)(symbol)
keras.saving.register_keras_serializable(package="keras_nlp")(symbol)


Expand Down
13 changes: 13 additions & 0 deletions keras_nlp/src/bounding_box/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2024 The KerasNLP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
Loading
Loading