Skip to content

Add TextToImage, StableDiffusion3Backbone and StableDiffusion3TextToImage #1816

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

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a089a8b
Add VGG16 backbone (#1737)
divyashreepathihalli Aug 8, 2024
73b7bad
Add `ResNetBackbone` and `ResNetImageClassifier` (#1765)
james77777778 Aug 12, 2024
26afc7e
Add CSP DarkNet backbone and classifier (#1774)
sachinprasadhs Aug 15, 2024
00ab4d5
Add `FeaturePyramidBackbone` and port weights from `timm` for `ResNet…
james77777778 Aug 15, 2024
9860756
Add DenseNet (#1775)
sachinprasadhs Aug 16, 2024
ececd14
Merge remote-tracking branch 'upstream/master' into keras-hub
divyashreepathihalli Aug 16, 2024
fd6f977
Add ViTDetBackbone (#1776)
divyashreepathihalli Aug 20, 2024
fc485d6
Add Mix transformer (#1780)
sachinprasadhs Aug 20, 2024
2797851
update input_image_shape -> image_shape (#1785)
divyashreepathihalli Aug 21, 2024
18f8880
Create __init__.py (#1788)
sachinprasadhs Aug 22, 2024
2ee893c
Hack package build script to rename to keras-hub (#1793)
mattdangerw Aug 26, 2024
fdf6b6b
Add CLIP and T5XXL for StableDiffusionV3 (#1790)
james77777778 Aug 26, 2024
beae2f4
Add Bounding Box Utils (#1791)
sineeli Aug 28, 2024
9289ab7
mobilenet_v3 added in keras-nlp (#1782)
ushareng Aug 28, 2024
09f470f
Pkgoogle/efficient net migration (#1778)
pkgoogle Aug 28, 2024
be8888d
Add the ResNet_vd backbone (#1766)
gowthamkpr Aug 28, 2024
536474a
Add `VAEImageDecoder` for StableDiffusionV3 (#1796)
james77777778 Aug 28, 2024
0fbd84b
Replace `Backbone` with `keras.Model` in `CLIPTextEncoder` and `T5XXL…
james77777778 Aug 28, 2024
9143468
Add pyramid output for densenet, cspDarknet (#1801)
sachinprasadhs Sep 3, 2024
791d7f6
Add `MMDiT` for StableDiffusionV3 (#1806)
james77777778 Sep 4, 2024
339669f
Add remaining bbox utils (#1804)
sineeli Sep 4, 2024
439f0a5
fix timm conversion script
sachinprasadhs Sep 5, 2024
dbaeabd
Revert "fix timm conversion script"
sachinprasadhs Sep 5, 2024
49def20
Fix timm conversion for rersnet (#1814)
sachinprasadhs Sep 5, 2024
52e90a5
Add `TextToImage` and `StableDiffusion3TextToImage`
james77777778 Sep 10, 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
39 changes: 39 additions & 0 deletions keras_nlp/api/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@
from keras_nlp.src.models.bloom.bloom_tokenizer import BloomTokenizer
from keras_nlp.src.models.causal_lm import CausalLM
from keras_nlp.src.models.classifier import Classifier
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 @@ -68,6 +74,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 @@ -86,6 +96,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_preprocessor import (
ElectraPreprocessor,
Expand All @@ -106,6 +119,7 @@
)
from keras_nlp.src.models.falcon.falcon_preprocessor import FalconPreprocessor
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 @@ -129,6 +143,7 @@
GPTNeoXPreprocessor,
)
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 @@ -153,6 +168,16 @@
MistralPreprocessor,
)
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 Down Expand Up @@ -180,6 +205,10 @@
from keras_nlp.src.models.phi3.phi3_preprocessor import Phi3Preprocessor
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_classifier import RobertaClassifier
from keras_nlp.src.models.roberta.roberta_masked_lm import RobertaMaskedLM
Expand All @@ -191,9 +220,19 @@
)
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.stable_diffusion_v3.stable_diffusion_3_backbone import (
StableDiffusion3Backbone,
)
from keras_nlp.src.models.stable_diffusion_v3.stable_diffusion_3_text_to_image import (
StableDiffusion3TextToImage,
)
from keras_nlp.src.models.t5.t5_backbone import T5Backbone
from keras_nlp.src.models.t5.t5_tokenizer import T5Tokenizer
from keras_nlp.src.models.task import Task
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_audio_feature_extractor import (
WhisperAudioFeatureExtractor,
)
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