keras-hub-nightly 0.16.1.dev202409250340__py3-none-any.whl → 0.16.1.dev202409270338__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- keras_hub/__init__.py +0 -13
- keras_hub/api/__init__.py +0 -13
- keras_hub/api/bounding_box/__init__.py +0 -13
- keras_hub/api/layers/__init__.py +3 -13
- keras_hub/api/metrics/__init__.py +0 -13
- keras_hub/api/models/__init__.py +16 -13
- keras_hub/api/samplers/__init__.py +0 -13
- keras_hub/api/tokenizers/__init__.py +1 -13
- keras_hub/api/utils/__init__.py +0 -13
- keras_hub/src/__init__.py +0 -13
- keras_hub/src/api_export.py +0 -14
- keras_hub/src/bounding_box/__init__.py +0 -13
- keras_hub/src/bounding_box/converters.py +0 -13
- keras_hub/src/bounding_box/formats.py +0 -13
- keras_hub/src/bounding_box/iou.py +1 -13
- keras_hub/src/bounding_box/to_dense.py +0 -14
- keras_hub/src/bounding_box/to_ragged.py +0 -13
- keras_hub/src/bounding_box/utils.py +0 -13
- keras_hub/src/bounding_box/validate_format.py +0 -14
- keras_hub/src/layers/__init__.py +0 -13
- keras_hub/src/layers/modeling/__init__.py +0 -13
- keras_hub/src/layers/modeling/alibi_bias.py +0 -13
- keras_hub/src/layers/modeling/cached_multi_head_attention.py +0 -14
- keras_hub/src/layers/modeling/f_net_encoder.py +0 -14
- keras_hub/src/layers/modeling/masked_lm_head.py +0 -14
- keras_hub/src/layers/modeling/position_embedding.py +0 -14
- keras_hub/src/layers/modeling/reversible_embedding.py +0 -14
- keras_hub/src/layers/modeling/rotary_embedding.py +0 -14
- keras_hub/src/layers/modeling/sine_position_encoding.py +0 -14
- keras_hub/src/layers/modeling/token_and_position_embedding.py +0 -14
- keras_hub/src/layers/modeling/transformer_decoder.py +0 -14
- keras_hub/src/layers/modeling/transformer_encoder.py +0 -14
- keras_hub/src/layers/modeling/transformer_layer_utils.py +0 -14
- keras_hub/src/layers/preprocessing/__init__.py +0 -13
- keras_hub/src/layers/preprocessing/audio_converter.py +0 -13
- keras_hub/src/layers/preprocessing/image_converter.py +0 -13
- keras_hub/src/layers/preprocessing/masked_lm_mask_generator.py +0 -15
- keras_hub/src/layers/preprocessing/multi_segment_packer.py +0 -14
- keras_hub/src/layers/preprocessing/preprocessing_layer.py +0 -14
- keras_hub/src/layers/preprocessing/random_deletion.py +0 -14
- keras_hub/src/layers/preprocessing/random_swap.py +0 -14
- keras_hub/src/layers/preprocessing/resizing_image_converter.py +0 -13
- keras_hub/src/layers/preprocessing/start_end_packer.py +0 -15
- keras_hub/src/metrics/__init__.py +0 -13
- keras_hub/src/metrics/bleu.py +0 -14
- keras_hub/src/metrics/edit_distance.py +0 -14
- keras_hub/src/metrics/perplexity.py +0 -14
- keras_hub/src/metrics/rouge_base.py +0 -14
- keras_hub/src/metrics/rouge_l.py +0 -14
- keras_hub/src/metrics/rouge_n.py +0 -14
- keras_hub/src/models/__init__.py +0 -13
- keras_hub/src/models/albert/__init__.py +0 -14
- keras_hub/src/models/albert/albert_backbone.py +0 -14
- keras_hub/src/models/albert/albert_masked_lm.py +0 -14
- keras_hub/src/models/albert/albert_masked_lm_preprocessor.py +0 -14
- keras_hub/src/models/albert/albert_presets.py +0 -14
- keras_hub/src/models/albert/albert_text_classifier.py +0 -14
- keras_hub/src/models/albert/albert_text_classifier_preprocessor.py +0 -14
- keras_hub/src/models/albert/albert_tokenizer.py +0 -14
- keras_hub/src/models/backbone.py +0 -14
- keras_hub/src/models/bart/__init__.py +0 -14
- keras_hub/src/models/bart/bart_backbone.py +0 -14
- keras_hub/src/models/bart/bart_presets.py +0 -13
- keras_hub/src/models/bart/bart_seq_2_seq_lm.py +0 -15
- keras_hub/src/models/bart/bart_seq_2_seq_lm_preprocessor.py +0 -15
- keras_hub/src/models/bart/bart_tokenizer.py +0 -15
- keras_hub/src/models/bert/__init__.py +0 -14
- keras_hub/src/models/bert/bert_backbone.py +0 -14
- keras_hub/src/models/bert/bert_masked_lm.py +0 -14
- keras_hub/src/models/bert/bert_masked_lm_preprocessor.py +0 -14
- keras_hub/src/models/bert/bert_presets.py +0 -13
- keras_hub/src/models/bert/bert_text_classifier.py +0 -14
- keras_hub/src/models/bert/bert_text_classifier_preprocessor.py +0 -14
- keras_hub/src/models/bert/bert_tokenizer.py +0 -14
- keras_hub/src/models/bloom/__init__.py +0 -14
- keras_hub/src/models/bloom/bloom_attention.py +0 -13
- keras_hub/src/models/bloom/bloom_backbone.py +0 -14
- keras_hub/src/models/bloom/bloom_causal_lm.py +0 -15
- keras_hub/src/models/bloom/bloom_causal_lm_preprocessor.py +0 -15
- keras_hub/src/models/bloom/bloom_decoder.py +0 -13
- keras_hub/src/models/bloom/bloom_presets.py +0 -13
- keras_hub/src/models/bloom/bloom_tokenizer.py +0 -15
- keras_hub/src/models/causal_lm.py +0 -14
- keras_hub/src/models/causal_lm_preprocessor.py +0 -13
- keras_hub/src/models/clip/__init__.py +0 -0
- keras_hub/src/models/{stable_diffusion_v3 → clip}/clip_encoder_block.py +8 -15
- keras_hub/src/models/clip/clip_preprocessor.py +134 -0
- keras_hub/src/models/clip/clip_text_encoder.py +139 -0
- keras_hub/src/models/{stable_diffusion_v3 → clip}/clip_tokenizer.py +65 -41
- keras_hub/src/models/csp_darknet/__init__.py +0 -13
- keras_hub/src/models/csp_darknet/csp_darknet_backbone.py +0 -13
- keras_hub/src/models/csp_darknet/csp_darknet_image_classifier.py +0 -13
- keras_hub/src/models/deberta_v3/__init__.py +0 -14
- keras_hub/src/models/deberta_v3/deberta_v3_backbone.py +0 -15
- keras_hub/src/models/deberta_v3/deberta_v3_masked_lm.py +0 -15
- keras_hub/src/models/deberta_v3/deberta_v3_masked_lm_preprocessor.py +0 -14
- keras_hub/src/models/deberta_v3/deberta_v3_presets.py +0 -13
- keras_hub/src/models/deberta_v3/deberta_v3_text_classifier.py +0 -15
- keras_hub/src/models/deberta_v3/deberta_v3_text_classifier_preprocessor.py +0 -14
- keras_hub/src/models/deberta_v3/deberta_v3_tokenizer.py +0 -15
- keras_hub/src/models/deberta_v3/disentangled_attention_encoder.py +0 -14
- keras_hub/src/models/deberta_v3/disentangled_self_attention.py +0 -14
- keras_hub/src/models/deberta_v3/relative_embedding.py +0 -14
- keras_hub/src/models/densenet/__init__.py +5 -13
- keras_hub/src/models/densenet/densenet_backbone.py +11 -21
- keras_hub/src/models/densenet/densenet_image_classifier.py +27 -17
- keras_hub/src/models/densenet/densenet_image_classifier_preprocessor.py +27 -0
- keras_hub/src/models/{stable_diffusion_v3/__init__.py → densenet/densenet_image_converter.py} +10 -0
- keras_hub/src/models/densenet/densenet_presets.py +56 -0
- keras_hub/src/models/distil_bert/__init__.py +0 -14
- keras_hub/src/models/distil_bert/distil_bert_backbone.py +0 -15
- keras_hub/src/models/distil_bert/distil_bert_masked_lm.py +0 -15
- keras_hub/src/models/distil_bert/distil_bert_masked_lm_preprocessor.py +0 -14
- keras_hub/src/models/distil_bert/distil_bert_presets.py +0 -13
- keras_hub/src/models/distil_bert/distil_bert_text_classifier.py +0 -15
- keras_hub/src/models/distil_bert/distil_bert_text_classifier_preprocessor.py +0 -15
- keras_hub/src/models/distil_bert/distil_bert_tokenizer.py +0 -15
- keras_hub/src/models/efficientnet/__init__.py +0 -13
- keras_hub/src/models/efficientnet/efficientnet_backbone.py +0 -13
- keras_hub/src/models/efficientnet/fusedmbconv.py +0 -14
- keras_hub/src/models/efficientnet/mbconv.py +0 -14
- keras_hub/src/models/electra/__init__.py +0 -14
- keras_hub/src/models/electra/electra_backbone.py +0 -14
- keras_hub/src/models/electra/electra_presets.py +0 -13
- keras_hub/src/models/electra/electra_tokenizer.py +0 -14
- keras_hub/src/models/f_net/__init__.py +0 -14
- keras_hub/src/models/f_net/f_net_backbone.py +0 -15
- keras_hub/src/models/f_net/f_net_masked_lm.py +0 -15
- keras_hub/src/models/f_net/f_net_masked_lm_preprocessor.py +0 -14
- keras_hub/src/models/f_net/f_net_presets.py +0 -13
- keras_hub/src/models/f_net/f_net_text_classifier.py +0 -15
- keras_hub/src/models/f_net/f_net_text_classifier_preprocessor.py +0 -15
- keras_hub/src/models/f_net/f_net_tokenizer.py +0 -15
- keras_hub/src/models/falcon/__init__.py +0 -14
- keras_hub/src/models/falcon/falcon_attention.py +0 -13
- keras_hub/src/models/falcon/falcon_backbone.py +0 -13
- keras_hub/src/models/falcon/falcon_causal_lm.py +0 -14
- keras_hub/src/models/falcon/falcon_causal_lm_preprocessor.py +0 -14
- keras_hub/src/models/falcon/falcon_presets.py +0 -13
- keras_hub/src/models/falcon/falcon_tokenizer.py +0 -15
- keras_hub/src/models/falcon/falcon_transformer_decoder.py +0 -13
- keras_hub/src/models/feature_pyramid_backbone.py +0 -13
- keras_hub/src/models/gemma/__init__.py +0 -14
- keras_hub/src/models/gemma/gemma_attention.py +0 -13
- keras_hub/src/models/gemma/gemma_backbone.py +0 -15
- keras_hub/src/models/gemma/gemma_causal_lm.py +0 -15
- keras_hub/src/models/gemma/gemma_causal_lm_preprocessor.py +0 -14
- keras_hub/src/models/gemma/gemma_decoder_block.py +0 -13
- keras_hub/src/models/gemma/gemma_presets.py +0 -13
- keras_hub/src/models/gemma/gemma_tokenizer.py +0 -14
- keras_hub/src/models/gemma/rms_normalization.py +0 -14
- keras_hub/src/models/gpt2/__init__.py +0 -14
- keras_hub/src/models/gpt2/gpt2_backbone.py +0 -15
- keras_hub/src/models/gpt2/gpt2_causal_lm.py +0 -15
- keras_hub/src/models/gpt2/gpt2_causal_lm_preprocessor.py +0 -14
- keras_hub/src/models/gpt2/gpt2_preprocessor.py +0 -15
- keras_hub/src/models/gpt2/gpt2_presets.py +0 -13
- keras_hub/src/models/gpt2/gpt2_tokenizer.py +0 -15
- keras_hub/src/models/gpt_neo_x/__init__.py +0 -13
- keras_hub/src/models/gpt_neo_x/gpt_neo_x_attention.py +0 -14
- keras_hub/src/models/gpt_neo_x/gpt_neo_x_backbone.py +0 -14
- keras_hub/src/models/gpt_neo_x/gpt_neo_x_causal_lm.py +0 -14
- keras_hub/src/models/gpt_neo_x/gpt_neo_x_causal_lm_preprocessor.py +0 -14
- keras_hub/src/models/gpt_neo_x/gpt_neo_x_decoder.py +0 -14
- keras_hub/src/models/gpt_neo_x/gpt_neo_x_tokenizer.py +0 -14
- keras_hub/src/models/image_classifier.py +0 -13
- keras_hub/src/models/image_classifier_preprocessor.py +0 -13
- keras_hub/src/models/image_segmenter.py +0 -13
- keras_hub/src/models/llama/__init__.py +0 -14
- keras_hub/src/models/llama/llama_attention.py +0 -13
- keras_hub/src/models/llama/llama_backbone.py +0 -13
- keras_hub/src/models/llama/llama_causal_lm.py +0 -13
- keras_hub/src/models/llama/llama_causal_lm_preprocessor.py +0 -15
- keras_hub/src/models/llama/llama_decoder.py +0 -13
- keras_hub/src/models/llama/llama_layernorm.py +0 -13
- keras_hub/src/models/llama/llama_presets.py +0 -13
- keras_hub/src/models/llama/llama_tokenizer.py +0 -14
- keras_hub/src/models/llama3/__init__.py +0 -14
- keras_hub/src/models/llama3/llama3_backbone.py +0 -14
- keras_hub/src/models/llama3/llama3_causal_lm.py +0 -13
- keras_hub/src/models/llama3/llama3_causal_lm_preprocessor.py +0 -14
- keras_hub/src/models/llama3/llama3_presets.py +0 -13
- keras_hub/src/models/llama3/llama3_tokenizer.py +0 -14
- keras_hub/src/models/masked_lm.py +0 -13
- keras_hub/src/models/masked_lm_preprocessor.py +0 -13
- keras_hub/src/models/mistral/__init__.py +0 -14
- keras_hub/src/models/mistral/mistral_attention.py +0 -13
- keras_hub/src/models/mistral/mistral_backbone.py +0 -14
- keras_hub/src/models/mistral/mistral_causal_lm.py +0 -14
- keras_hub/src/models/mistral/mistral_causal_lm_preprocessor.py +0 -14
- keras_hub/src/models/mistral/mistral_layer_norm.py +0 -13
- keras_hub/src/models/mistral/mistral_presets.py +0 -13
- keras_hub/src/models/mistral/mistral_tokenizer.py +0 -14
- keras_hub/src/models/mistral/mistral_transformer_decoder.py +0 -13
- keras_hub/src/models/mix_transformer/__init__.py +0 -13
- keras_hub/src/models/mix_transformer/mix_transformer_backbone.py +0 -13
- keras_hub/src/models/mix_transformer/mix_transformer_classifier.py +0 -13
- keras_hub/src/models/mix_transformer/mix_transformer_layers.py +0 -13
- keras_hub/src/models/mobilenet/__init__.py +0 -13
- keras_hub/src/models/mobilenet/mobilenet_backbone.py +0 -13
- keras_hub/src/models/mobilenet/mobilenet_image_classifier.py +0 -13
- keras_hub/src/models/opt/__init__.py +0 -14
- keras_hub/src/models/opt/opt_backbone.py +0 -15
- keras_hub/src/models/opt/opt_causal_lm.py +0 -15
- keras_hub/src/models/opt/opt_causal_lm_preprocessor.py +0 -13
- keras_hub/src/models/opt/opt_presets.py +0 -13
- keras_hub/src/models/opt/opt_tokenizer.py +0 -15
- keras_hub/src/models/pali_gemma/__init__.py +0 -13
- keras_hub/src/models/pali_gemma/pali_gemma_backbone.py +0 -13
- keras_hub/src/models/pali_gemma/pali_gemma_causal_lm.py +0 -13
- keras_hub/src/models/pali_gemma/pali_gemma_causal_lm_preprocessor.py +0 -13
- keras_hub/src/models/pali_gemma/pali_gemma_decoder_block.py +0 -14
- keras_hub/src/models/pali_gemma/pali_gemma_image_converter.py +0 -13
- keras_hub/src/models/pali_gemma/pali_gemma_presets.py +0 -13
- keras_hub/src/models/pali_gemma/pali_gemma_tokenizer.py +0 -13
- keras_hub/src/models/pali_gemma/pali_gemma_vit.py +0 -13
- keras_hub/src/models/phi3/__init__.py +0 -14
- keras_hub/src/models/phi3/phi3_attention.py +0 -13
- keras_hub/src/models/phi3/phi3_backbone.py +0 -13
- keras_hub/src/models/phi3/phi3_causal_lm.py +0 -13
- keras_hub/src/models/phi3/phi3_causal_lm_preprocessor.py +0 -14
- keras_hub/src/models/phi3/phi3_decoder.py +0 -13
- keras_hub/src/models/phi3/phi3_layernorm.py +0 -13
- keras_hub/src/models/phi3/phi3_presets.py +0 -13
- keras_hub/src/models/phi3/phi3_rotary_embedding.py +0 -13
- keras_hub/src/models/phi3/phi3_tokenizer.py +0 -13
- keras_hub/src/models/preprocessor.py +51 -32
- keras_hub/src/models/resnet/__init__.py +0 -14
- keras_hub/src/models/resnet/resnet_backbone.py +0 -13
- keras_hub/src/models/resnet/resnet_image_classifier.py +0 -13
- keras_hub/src/models/resnet/resnet_image_classifier_preprocessor.py +0 -14
- keras_hub/src/models/resnet/resnet_image_converter.py +0 -13
- keras_hub/src/models/resnet/resnet_presets.py +0 -13
- keras_hub/src/models/retinanet/__init__.py +0 -13
- keras_hub/src/models/retinanet/anchor_generator.py +0 -14
- keras_hub/src/models/retinanet/box_matcher.py +0 -14
- keras_hub/src/models/retinanet/non_max_supression.py +0 -14
- keras_hub/src/models/roberta/__init__.py +0 -14
- keras_hub/src/models/roberta/roberta_backbone.py +0 -15
- keras_hub/src/models/roberta/roberta_masked_lm.py +0 -15
- keras_hub/src/models/roberta/roberta_masked_lm_preprocessor.py +0 -14
- keras_hub/src/models/roberta/roberta_presets.py +0 -13
- keras_hub/src/models/roberta/roberta_text_classifier.py +0 -15
- keras_hub/src/models/roberta/roberta_text_classifier_preprocessor.py +0 -14
- keras_hub/src/models/roberta/roberta_tokenizer.py +0 -15
- keras_hub/src/models/sam/__init__.py +0 -13
- keras_hub/src/models/sam/sam_backbone.py +0 -14
- keras_hub/src/models/sam/sam_image_segmenter.py +0 -14
- keras_hub/src/models/sam/sam_layers.py +0 -14
- keras_hub/src/models/sam/sam_mask_decoder.py +0 -14
- keras_hub/src/models/sam/sam_prompt_encoder.py +0 -14
- keras_hub/src/models/sam/sam_transformer.py +0 -14
- keras_hub/src/models/seq_2_seq_lm.py +0 -13
- keras_hub/src/models/seq_2_seq_lm_preprocessor.py +0 -13
- keras_hub/src/models/stable_diffusion_3/__init__.py +9 -0
- keras_hub/src/models/stable_diffusion_3/flow_match_euler_discrete_scheduler.py +80 -0
- keras_hub/src/models/{stable_diffusion_v3 → stable_diffusion_3}/mmdit.py +351 -39
- keras_hub/src/models/stable_diffusion_3/stable_diffusion_3_backbone.py +631 -0
- keras_hub/src/models/stable_diffusion_3/stable_diffusion_3_presets.py +31 -0
- keras_hub/src/models/stable_diffusion_3/stable_diffusion_3_text_to_image.py +138 -0
- keras_hub/src/models/stable_diffusion_3/stable_diffusion_3_text_to_image_preprocessor.py +83 -0
- keras_hub/src/models/{stable_diffusion_v3/t5_xxl_text_encoder.py → stable_diffusion_3/t5_encoder.py} +7 -20
- keras_hub/src/models/stable_diffusion_3/vae_image_decoder.py +320 -0
- keras_hub/src/models/t5/__init__.py +0 -14
- keras_hub/src/models/t5/t5_backbone.py +0 -14
- keras_hub/src/models/t5/t5_layer_norm.py +0 -14
- keras_hub/src/models/t5/t5_multi_head_attention.py +0 -14
- keras_hub/src/models/{stable_diffusion_v3/t5_xxl_preprocessor.py → t5/t5_preprocessor.py} +12 -16
- keras_hub/src/models/t5/t5_presets.py +0 -13
- keras_hub/src/models/t5/t5_tokenizer.py +0 -14
- keras_hub/src/models/t5/t5_transformer_layer.py +0 -14
- keras_hub/src/models/task.py +0 -14
- keras_hub/src/models/text_classifier.py +0 -13
- keras_hub/src/models/text_classifier_preprocessor.py +0 -13
- keras_hub/src/models/text_to_image.py +282 -0
- keras_hub/src/models/vgg/__init__.py +0 -13
- keras_hub/src/models/vgg/vgg_backbone.py +0 -13
- keras_hub/src/models/vgg/vgg_image_classifier.py +0 -13
- keras_hub/src/models/vit_det/__init__.py +0 -13
- keras_hub/src/models/vit_det/vit_det_backbone.py +0 -14
- keras_hub/src/models/vit_det/vit_layers.py +0 -15
- keras_hub/src/models/whisper/__init__.py +0 -14
- keras_hub/src/models/whisper/whisper_audio_converter.py +0 -15
- keras_hub/src/models/whisper/whisper_backbone.py +0 -15
- keras_hub/src/models/whisper/whisper_cached_multi_head_attention.py +0 -13
- keras_hub/src/models/whisper/whisper_decoder.py +0 -14
- keras_hub/src/models/whisper/whisper_encoder.py +0 -14
- keras_hub/src/models/whisper/whisper_presets.py +0 -14
- keras_hub/src/models/whisper/whisper_tokenizer.py +0 -14
- keras_hub/src/models/xlm_roberta/__init__.py +0 -14
- keras_hub/src/models/xlm_roberta/xlm_roberta_backbone.py +0 -15
- keras_hub/src/models/xlm_roberta/xlm_roberta_masked_lm.py +0 -15
- keras_hub/src/models/xlm_roberta/xlm_roberta_masked_lm_preprocessor.py +0 -14
- keras_hub/src/models/xlm_roberta/xlm_roberta_presets.py +0 -13
- keras_hub/src/models/xlm_roberta/xlm_roberta_text_classifier.py +0 -15
- keras_hub/src/models/xlm_roberta/xlm_roberta_text_classifier_preprocessor.py +0 -15
- keras_hub/src/models/xlm_roberta/xlm_roberta_tokenizer.py +0 -15
- keras_hub/src/models/xlnet/__init__.py +0 -13
- keras_hub/src/models/xlnet/relative_attention.py +0 -14
- keras_hub/src/models/xlnet/xlnet_backbone.py +0 -14
- keras_hub/src/models/xlnet/xlnet_content_and_query_embedding.py +0 -14
- keras_hub/src/models/xlnet/xlnet_encoder.py +0 -14
- keras_hub/src/samplers/__init__.py +0 -13
- keras_hub/src/samplers/beam_sampler.py +0 -14
- keras_hub/src/samplers/contrastive_sampler.py +0 -14
- keras_hub/src/samplers/greedy_sampler.py +0 -14
- keras_hub/src/samplers/random_sampler.py +0 -14
- keras_hub/src/samplers/sampler.py +0 -14
- keras_hub/src/samplers/serialization.py +0 -14
- keras_hub/src/samplers/top_k_sampler.py +0 -14
- keras_hub/src/samplers/top_p_sampler.py +0 -14
- keras_hub/src/tests/__init__.py +0 -13
- keras_hub/src/tests/test_case.py +0 -14
- keras_hub/src/tokenizers/__init__.py +0 -13
- keras_hub/src/tokenizers/byte_pair_tokenizer.py +0 -14
- keras_hub/src/tokenizers/byte_tokenizer.py +0 -14
- keras_hub/src/tokenizers/sentence_piece_tokenizer.py +0 -14
- keras_hub/src/tokenizers/sentence_piece_tokenizer_trainer.py +0 -14
- keras_hub/src/tokenizers/tokenizer.py +23 -27
- keras_hub/src/tokenizers/unicode_codepoint_tokenizer.py +0 -15
- keras_hub/src/tokenizers/word_piece_tokenizer.py +0 -14
- keras_hub/src/tokenizers/word_piece_tokenizer_trainer.py +0 -15
- keras_hub/src/utils/__init__.py +0 -13
- keras_hub/src/utils/imagenet/__init__.py +0 -13
- keras_hub/src/utils/imagenet/imagenet_utils.py +0 -13
- keras_hub/src/utils/keras_utils.py +0 -14
- keras_hub/src/utils/pipeline_model.py +0 -14
- keras_hub/src/utils/preset_utils.py +32 -76
- keras_hub/src/utils/python_utils.py +0 -13
- keras_hub/src/utils/tensor_utils.py +0 -14
- keras_hub/src/utils/timm/__init__.py +0 -13
- keras_hub/src/utils/timm/convert_densenet.py +107 -0
- keras_hub/src/utils/timm/convert_resnet.py +0 -13
- keras_hub/src/utils/timm/preset_loader.py +3 -13
- keras_hub/src/utils/transformers/__init__.py +0 -13
- keras_hub/src/utils/transformers/convert_albert.py +0 -13
- keras_hub/src/utils/transformers/convert_bart.py +0 -13
- keras_hub/src/utils/transformers/convert_bert.py +0 -13
- keras_hub/src/utils/transformers/convert_distilbert.py +0 -13
- keras_hub/src/utils/transformers/convert_gemma.py +0 -13
- keras_hub/src/utils/transformers/convert_gpt2.py +0 -13
- keras_hub/src/utils/transformers/convert_llama3.py +0 -13
- keras_hub/src/utils/transformers/convert_mistral.py +0 -13
- keras_hub/src/utils/transformers/convert_pali_gemma.py +0 -13
- keras_hub/src/utils/transformers/preset_loader.py +1 -15
- keras_hub/src/utils/transformers/safetensor_utils.py +9 -15
- keras_hub/src/version_utils.py +1 -15
- {keras_hub_nightly-0.16.1.dev202409250340.dist-info → keras_hub_nightly-0.16.1.dev202409270338.dist-info}/METADATA +30 -27
- keras_hub_nightly-0.16.1.dev202409270338.dist-info/RECORD +351 -0
- keras_hub/src/models/stable_diffusion_v3/clip_preprocessor.py +0 -93
- keras_hub/src/models/stable_diffusion_v3/clip_text_encoder.py +0 -149
- keras_hub/src/models/stable_diffusion_v3/mmdit_block.py +0 -317
- keras_hub/src/models/stable_diffusion_v3/vae_attention.py +0 -126
- keras_hub/src/models/stable_diffusion_v3/vae_image_decoder.py +0 -186
- keras_hub_nightly-0.16.1.dev202409250340.dist-info/RECORD +0 -342
- {keras_hub_nightly-0.16.1.dev202409250340.dist-info → keras_hub_nightly-0.16.1.dev202409270338.dist-info}/WHEEL +0 -0
- {keras_hub_nightly-0.16.1.dev202409250340.dist-info → keras_hub_nightly-0.16.1.dev202409270338.dist-info}/top_level.txt +0 -0
@@ -1,25 +1,14 @@
|
|
1
|
-
# Copyright 2024 The KerasHub Authors
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
1
|
import keras
|
15
2
|
|
3
|
+
from keras_hub.src.api_export import keras_hub_export
|
16
4
|
from keras_hub.src.layers.preprocessing.start_end_packer import StartEndPacker
|
17
5
|
from keras_hub.src.models.preprocessor import Preprocessor
|
18
6
|
from keras_hub.src.models.t5.t5_tokenizer import T5Tokenizer
|
19
7
|
from keras_hub.src.utils.tensor_utils import preprocessing_function
|
20
8
|
|
21
9
|
|
22
|
-
|
10
|
+
@keras_hub_export("keras_hub.models.T5Preprocessor")
|
11
|
+
class T5Preprocessor(Preprocessor):
|
23
12
|
tokenizer_cls = T5Tokenizer
|
24
13
|
|
25
14
|
def __init__(
|
@@ -49,10 +38,17 @@ class T5XXLPreprocessor(Preprocessor):
|
|
49
38
|
self.built = True
|
50
39
|
|
51
40
|
@preprocessing_function
|
52
|
-
def call(
|
41
|
+
def call(
|
42
|
+
self,
|
43
|
+
x,
|
44
|
+
y=None,
|
45
|
+
sample_weight=None,
|
46
|
+
sequence_length=None,
|
47
|
+
):
|
48
|
+
sequence_length = sequence_length or self.sequence_length
|
53
49
|
token_ids, padding_mask = self.packer(
|
54
50
|
self.tokenizer(x),
|
55
|
-
sequence_length=sequence_length
|
51
|
+
sequence_length=sequence_length,
|
56
52
|
add_start_value=self.add_start_token,
|
57
53
|
add_end_value=self.add_end_token,
|
58
54
|
)
|
@@ -1,16 +1,3 @@
|
|
1
|
-
# Copyright 2024 The KerasHub Authors
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
1
|
"""XLM-RoBERTa model preset configurations."""
|
15
2
|
|
16
3
|
backbone_presets = {
|
@@ -1,17 +1,3 @@
|
|
1
|
-
# Copyright 2024 The KerasHub Authors
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
1
|
from keras_hub.src.api_export import keras_hub_export
|
16
2
|
from keras_hub.src.models.t5.t5_backbone import T5Backbone
|
17
3
|
from keras_hub.src.tokenizers.sentence_piece_tokenizer import (
|
@@ -1,17 +1,3 @@
|
|
1
|
-
# Copyright 2024 The KerasHub Authors
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
1
|
import keras
|
16
2
|
from keras import ops
|
17
3
|
|
keras_hub/src/models/task.py
CHANGED
@@ -1,17 +1,3 @@
|
|
1
|
-
# Copyright 2024 The KerasHub Authors
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
1
|
import os
|
16
2
|
|
17
3
|
import keras
|
@@ -1,16 +1,3 @@
|
|
1
|
-
# Copyright 2024 The KerasHub Authors
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
1
|
import keras
|
15
2
|
|
16
3
|
from keras_hub.src.api_export import keras_hub_export
|
@@ -1,16 +1,3 @@
|
|
1
|
-
# Copyright 2024 The KerasHub Authors
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
1
|
import keras
|
15
2
|
|
16
3
|
from keras_hub.src.api_export import keras_hub_export
|
@@ -0,0 +1,282 @@
|
|
1
|
+
import itertools
|
2
|
+
from functools import partial
|
3
|
+
|
4
|
+
import keras
|
5
|
+
from keras import ops
|
6
|
+
from keras import random
|
7
|
+
|
8
|
+
from keras_hub.src.api_export import keras_hub_export
|
9
|
+
from keras_hub.src.models.task import Task
|
10
|
+
|
11
|
+
try:
|
12
|
+
import tensorflow as tf
|
13
|
+
except ImportError:
|
14
|
+
tf = None
|
15
|
+
|
16
|
+
|
17
|
+
@keras_hub_export("keras_hub.models.TextToImage")
|
18
|
+
class TextToImage(Task):
|
19
|
+
"""Base class for text-to-image tasks.
|
20
|
+
|
21
|
+
`TextToImage` tasks wrap a `keras_hub.models.Backbone` and
|
22
|
+
a `keras_hub.models.Preprocessor` to create a model that can be used for
|
23
|
+
generation and generative fine-tuning.
|
24
|
+
|
25
|
+
`TextToImage` tasks provide an additional, high-level `generate()` function
|
26
|
+
which can be used to generate image by token with a string in, image out
|
27
|
+
signature.
|
28
|
+
|
29
|
+
All `TextToImage` tasks include a `from_preset()` constructor which can be
|
30
|
+
used to load a pre-trained config and weights.
|
31
|
+
|
32
|
+
Example:
|
33
|
+
|
34
|
+
```python
|
35
|
+
# Load a Stable Diffusion 3 backbone with pre-trained weights.
|
36
|
+
text_to_image = keras_hub.models.TextToImage.from_preset(
|
37
|
+
"stable_diffusion_3_medium",
|
38
|
+
)
|
39
|
+
text_to_image.generate(
|
40
|
+
"Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"
|
41
|
+
)
|
42
|
+
|
43
|
+
# Load a Stable Diffusion 3 backbone at bfloat16 precision.
|
44
|
+
text_to_image = keras_hub.models.TextToImage.from_preset(
|
45
|
+
"stable_diffusion_3_medium",
|
46
|
+
dtype="bfloat16",
|
47
|
+
)
|
48
|
+
text_to_image.generate(
|
49
|
+
"Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"
|
50
|
+
)
|
51
|
+
```
|
52
|
+
"""
|
53
|
+
|
54
|
+
def __init__(self, *args, **kwargs):
|
55
|
+
super().__init__(*args, **kwargs)
|
56
|
+
# Default compilation.
|
57
|
+
self.compile()
|
58
|
+
|
59
|
+
@property
|
60
|
+
def latent_shape(self):
|
61
|
+
return tuple(self.backbone.latent_shape)
|
62
|
+
|
63
|
+
def compile(
|
64
|
+
self,
|
65
|
+
optimizer="auto",
|
66
|
+
loss="auto",
|
67
|
+
*,
|
68
|
+
metrics="auto",
|
69
|
+
**kwargs,
|
70
|
+
):
|
71
|
+
"""Configures the `TextToImage` task for training.
|
72
|
+
|
73
|
+
The `TextToImage` task extends the default compilation signature of
|
74
|
+
`keras.Model.compile` with defaults for `optimizer`, `loss`, and
|
75
|
+
`metrics`. To override these defaults, pass any value
|
76
|
+
to these arguments during compilation.
|
77
|
+
|
78
|
+
Args:
|
79
|
+
optimizer: `"auto"`, an optimizer name, or a `keras.Optimizer`
|
80
|
+
instance. Defaults to `"auto"`, which uses the default optimizer
|
81
|
+
for the given model and task. See `keras.Model.compile` and
|
82
|
+
`keras.optimizers` for more info on possible `optimizer` values.
|
83
|
+
loss: `"auto"`, a loss name, or a `keras.losses.Loss` instance.
|
84
|
+
Defaults to `"auto"`, where a
|
85
|
+
`keras.losses.MeanSquaredError` loss will be applied. See
|
86
|
+
`keras.Model.compile` and `keras.losses` for more info on
|
87
|
+
possible `loss` values.
|
88
|
+
metrics: `"auto"`, or a list of metrics to be evaluated by
|
89
|
+
the model during training and testing. Defaults to `"auto"`,
|
90
|
+
where a `keras.metrics.MeanSquaredError` will be applied to
|
91
|
+
track the loss of the model during training. See
|
92
|
+
`keras.Model.compile` and `keras.metrics` for more info on
|
93
|
+
possible `metrics` values.
|
94
|
+
**kwargs: See `keras.Model.compile` for a full list of arguments
|
95
|
+
supported by the compile method.
|
96
|
+
"""
|
97
|
+
# Ref: https://github.com/huggingface/diffusers/blob/main/examples/text_to_image/train_text_to_image.py#L410-L414
|
98
|
+
if optimizer == "auto":
|
99
|
+
optimizer = keras.optimizers.AdamW(
|
100
|
+
1e-4, weight_decay=1e-2, epsilon=1e-8, clipnorm=1.0
|
101
|
+
)
|
102
|
+
if loss == "auto":
|
103
|
+
loss = keras.losses.MeanSquaredError()
|
104
|
+
if metrics == "auto":
|
105
|
+
metrics = [keras.metrics.MeanSquaredError()]
|
106
|
+
super().compile(
|
107
|
+
optimizer=optimizer,
|
108
|
+
loss=loss,
|
109
|
+
metrics=metrics,
|
110
|
+
**kwargs,
|
111
|
+
)
|
112
|
+
self.generate_function = None
|
113
|
+
|
114
|
+
def generate_step(self, *args, **kwargs):
|
115
|
+
"""Run generation on batches of input."""
|
116
|
+
raise NotImplementedError
|
117
|
+
|
118
|
+
def make_generate_function(self):
|
119
|
+
"""Create or return the compiled generation function."""
|
120
|
+
if self.generate_function is not None:
|
121
|
+
return self.generate_function
|
122
|
+
|
123
|
+
self.generate_function = self.generate_step
|
124
|
+
if keras.config.backend() == "torch":
|
125
|
+
import torch
|
126
|
+
|
127
|
+
def wrapped_function(*args, **kwargs):
|
128
|
+
with torch.no_grad():
|
129
|
+
return self.generate_step(*args, **kwargs)
|
130
|
+
|
131
|
+
self.generate_function = wrapped_function
|
132
|
+
elif keras.config.backend() == "tensorflow" and not self.run_eagerly:
|
133
|
+
self.generate_function = tf.function(
|
134
|
+
self.generate_step, jit_compile=self.jit_compile
|
135
|
+
)
|
136
|
+
elif keras.config.backend() == "jax" and not self.run_eagerly:
|
137
|
+
import jax
|
138
|
+
|
139
|
+
@partial(jax.jit)
|
140
|
+
def compiled_function(state, *args, **kwargs):
|
141
|
+
(
|
142
|
+
trainable_variables,
|
143
|
+
non_trainable_variables,
|
144
|
+
) = state
|
145
|
+
mapping = itertools.chain(
|
146
|
+
zip(self.trainable_variables, trainable_variables),
|
147
|
+
zip(self.non_trainable_variables, non_trainable_variables),
|
148
|
+
)
|
149
|
+
|
150
|
+
with keras.StatelessScope(state_mapping=mapping):
|
151
|
+
outputs = self.generate_step(*args, **kwargs)
|
152
|
+
return outputs
|
153
|
+
|
154
|
+
def wrapped_function(*args, **kwargs):
|
155
|
+
# Create an explicit tuple of all variable state.
|
156
|
+
state = (
|
157
|
+
# Use the explicit variable.value to preserve the
|
158
|
+
# sharding spec of distribution.
|
159
|
+
[v.value for v in self.trainable_variables],
|
160
|
+
[v.value for v in self.non_trainable_variables],
|
161
|
+
)
|
162
|
+
outputs = compiled_function(state, *args, **kwargs)
|
163
|
+
return outputs
|
164
|
+
|
165
|
+
self.generate_function = wrapped_function
|
166
|
+
return self.generate_function
|
167
|
+
|
168
|
+
def _normalize_generate_inputs(self, inputs):
|
169
|
+
"""Normalize user input to the generate function.
|
170
|
+
|
171
|
+
This function converts all inputs to tensors, adds a batch dimension if
|
172
|
+
necessary, and returns a iterable "dataset like" object (either an
|
173
|
+
actual `tf.data.Dataset` or a list with a single batch element).
|
174
|
+
"""
|
175
|
+
if tf and isinstance(inputs, tf.data.Dataset):
|
176
|
+
return inputs.as_numpy_iterator(), False
|
177
|
+
|
178
|
+
def normalize(x):
|
179
|
+
if isinstance(x, str):
|
180
|
+
return [x], True
|
181
|
+
if tf and isinstance(x, tf.Tensor) and x.shape.rank == 0:
|
182
|
+
return x[tf.newaxis], True
|
183
|
+
return x, False
|
184
|
+
|
185
|
+
if isinstance(inputs, dict):
|
186
|
+
for key in inputs:
|
187
|
+
inputs[key], input_is_scalar = normalize(inputs[key])
|
188
|
+
else:
|
189
|
+
inputs, input_is_scalar = normalize(inputs)
|
190
|
+
|
191
|
+
return inputs, input_is_scalar
|
192
|
+
|
193
|
+
def _normalize_generate_outputs(self, outputs, input_is_scalar):
|
194
|
+
"""Normalize user output from the generate function.
|
195
|
+
|
196
|
+
This function converts all output to numpy with a value range of
|
197
|
+
`[0, 255]`. If a batch dimension was added to the input, it is removed
|
198
|
+
from the output.
|
199
|
+
"""
|
200
|
+
|
201
|
+
def normalize(x):
|
202
|
+
outputs = ops.clip(ops.divide(ops.add(x, 1.0), 2.0), 0.0, 1.0)
|
203
|
+
outputs = ops.cast(ops.round(ops.multiply(outputs, 255.0)), "uint8")
|
204
|
+
outputs = ops.convert_to_numpy(outputs)
|
205
|
+
if input_is_scalar:
|
206
|
+
outputs = outputs[0]
|
207
|
+
return outputs
|
208
|
+
|
209
|
+
if isinstance(outputs[0], dict):
|
210
|
+
normalized = {}
|
211
|
+
for key in outputs[0]:
|
212
|
+
normalized[key] = normalize([x[key] for x in outputs])
|
213
|
+
return normalized
|
214
|
+
return normalize([x for x in outputs])
|
215
|
+
|
216
|
+
def generate(
|
217
|
+
self,
|
218
|
+
inputs,
|
219
|
+
negative_inputs,
|
220
|
+
num_steps,
|
221
|
+
guidance_scale,
|
222
|
+
seed=None,
|
223
|
+
):
|
224
|
+
"""Generate image based on the provided `inputs` and `negative_inputs`.
|
225
|
+
|
226
|
+
If `inputs` are a `tf.data.Dataset`, outputs will be generated
|
227
|
+
"batch-by-batch" and concatenated. Otherwise, all inputs will be
|
228
|
+
processed as batches.
|
229
|
+
|
230
|
+
Args:
|
231
|
+
inputs: python data, tensor data, or a `tf.data.Dataset`.
|
232
|
+
negative_inputs: python data, tensor data, or a `tf.data.Dataset`.
|
233
|
+
Unlike `inputs`, these are used as negative inputs to guide the
|
234
|
+
generation. If not provided, it defaults to `""` for each input
|
235
|
+
in `inputs`.
|
236
|
+
num_steps: int. The number of diffusion steps to take.
|
237
|
+
guidance_scale: float. The classifier free guidance scale defined in
|
238
|
+
[Classifier-Free Diffusion Guidance](
|
239
|
+
https://arxiv.org/abs/2207.12598). A higher scale encourages
|
240
|
+
generating images more closely related to the prompts, typically
|
241
|
+
at the cost of lower image quality.
|
242
|
+
seed: optional int. Used as a random seed.
|
243
|
+
"""
|
244
|
+
num_steps = ops.convert_to_tensor(num_steps, "int32")
|
245
|
+
guidance_scale = ops.convert_to_tensor(guidance_scale)
|
246
|
+
|
247
|
+
# Setup our three main passes.
|
248
|
+
# 1. Preprocessing strings to dense integer tensors.
|
249
|
+
# 2. Generate outputs via a compiled function on dense tensors.
|
250
|
+
# 3. Postprocess dense tensors to a value range of `[0, 255]`.
|
251
|
+
generate_function = self.make_generate_function()
|
252
|
+
|
253
|
+
def preprocess(x):
|
254
|
+
return self.preprocessor.generate_preprocess(x)
|
255
|
+
|
256
|
+
# Normalize and preprocess inputs.
|
257
|
+
inputs, input_is_scalar = self._normalize_generate_inputs(inputs)
|
258
|
+
if negative_inputs is None:
|
259
|
+
negative_inputs = [""] * len(inputs)
|
260
|
+
negative_inputs, _ = self._normalize_generate_inputs(negative_inputs)
|
261
|
+
|
262
|
+
if self.preprocessor is not None:
|
263
|
+
inputs = preprocess(inputs)
|
264
|
+
negative_inputs = preprocess(negative_inputs)
|
265
|
+
if isinstance(inputs, dict):
|
266
|
+
batch_size = len(inputs[list(inputs.keys())[0]])
|
267
|
+
else:
|
268
|
+
batch_size = len(inputs)
|
269
|
+
|
270
|
+
# Initialize random latents.
|
271
|
+
latent_shape = (batch_size,) + self.latent_shape[1:]
|
272
|
+
latents = random.normal(latent_shape, dtype="float32", seed=seed)
|
273
|
+
|
274
|
+
# Text-to-image.
|
275
|
+
outputs = generate_function(
|
276
|
+
latents,
|
277
|
+
inputs,
|
278
|
+
negative_inputs,
|
279
|
+
num_steps,
|
280
|
+
guidance_scale,
|
281
|
+
)
|
282
|
+
return self._normalize_generate_outputs(outputs, input_is_scalar)
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# Copyright 2024 The KerasHub Authors
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
@@ -1,16 +1,3 @@
|
|
1
|
-
# Copyright 2023 The KerasHub Authors
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
1
|
import keras
|
15
2
|
from keras import layers
|
16
3
|
|
@@ -1,16 +1,3 @@
|
|
1
|
-
# Copyright 2023 The KerasHub Authors
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
1
|
import keras
|
15
2
|
|
16
3
|
from keras_hub.src.api_export import keras_hub_export
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# Copyright 2024 The KerasHub Authors
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
@@ -1,17 +1,3 @@
|
|
1
|
-
# Copyright 2024 The KerasCV Authors
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
1
|
import keras
|
16
2
|
from keras import ops
|
17
3
|
|
@@ -1,18 +1,3 @@
|
|
1
|
-
# Copyright 2024 The KerasCV Authors
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
|
-
|
16
1
|
import keras
|
17
2
|
from keras import ops
|
18
3
|
|
@@ -1,17 +1,3 @@
|
|
1
|
-
# Copyright 2024 The KerasHub Authors
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
1
|
from keras_hub.src.models.whisper.whisper_backbone import WhisperBackbone
|
16
2
|
from keras_hub.src.models.whisper.whisper_presets import backbone_presets
|
17
3
|
from keras_hub.src.utils.preset_utils import register_presets
|
@@ -1,18 +1,3 @@
|
|
1
|
-
# Copyright 2024 The KerasHub Authors
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
|
-
|
16
1
|
import numpy as np
|
17
2
|
|
18
3
|
from keras_hub.src.api_export import keras_hub_export
|
@@ -1,18 +1,3 @@
|
|
1
|
-
# Copyright 2024 The KerasHub Authors
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
|
-
|
16
1
|
import keras
|
17
2
|
from keras import ops
|
18
3
|
|
@@ -1,16 +1,3 @@
|
|
1
|
-
# Copyright 2024 The KerasHub Authors
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
1
|
"""Whisper Cached Multi-Head Attention layer."""
|
15
2
|
|
16
3
|
import collections
|
@@ -1,19 +1,5 @@
|
|
1
|
-
# Copyright 2024 The KerasHub Authors
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
1
|
"""Whisper decoder block."""
|
15
2
|
|
16
|
-
|
17
3
|
import keras
|
18
4
|
|
19
5
|
from keras_hub.src.layers.modeling.transformer_decoder import TransformerDecoder
|
@@ -1,19 +1,5 @@
|
|
1
|
-
# Copyright 2024 The KerasHub Authors
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
1
|
"""Whisper encoder block."""
|
15
2
|
|
16
|
-
|
17
3
|
import keras
|
18
4
|
|
19
5
|
from keras_hub.src.layers.modeling.transformer_encoder import TransformerEncoder
|