keras-hub-nightly 0.19.0.dev202412080355__py3-none-any.whl → 0.19.0.dev202412100354__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.
@@ -1,7 +1,7 @@
1
1
  from keras_hub.src.api_export import keras_hub_export
2
2
 
3
3
  # Unique source of truth for the version number.
4
- __version__ = "0.19.0.dev202412080355"
4
+ __version__ = "0.19.0.dev202412100354"
5
5
 
6
6
 
7
7
  @keras_hub_export("keras_hub.version")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: keras-hub-nightly
3
- Version: 0.19.0.dev202412080355
3
+ Version: 0.19.0.dev202412100354
4
4
  Summary: Industry-strength Natural Language Processing extensions for Keras.
5
5
  Home-page: https://github.com/keras-team/keras-hub
6
6
  Author: Keras team
@@ -31,7 +31,7 @@ Provides-Extra: extras
31
31
  Requires-Dist: rouge-score; extra == "extras"
32
32
  Requires-Dist: sentencepiece; extra == "extras"
33
33
 
34
- # KerasHub: Multi-framework Models
34
+ # KerasHub: Multi-framework Pretrained Models
35
35
  [![](https://github.com/keras-team/keras-hub/workflows/Tests/badge.svg?branch=master)](https://github.com/keras-team/keras-hub/actions?query=workflow%3ATests+branch%3Amaster)
36
36
  ![Python](https://img.shields.io/badge/python-v3.9.0+-success.svg)
37
37
  [![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/keras-team/keras-hub/issues)
@@ -40,98 +40,115 @@ Requires-Dist: sentencepiece; extra == "extras"
40
40
  > 📢 KerasNLP is now KerasHub! 📢 Read
41
41
  > [the announcement](https://github.com/keras-team/keras-hub/issues/1831).
42
42
 
43
- KerasHub is a library that supports natural language processing, computer
44
- vision, audio, and multimodal backbones and task models, working natively with
45
- TensorFlow, JAX, or PyTorch. KerasHub provides a repository of pre-trained
46
- models and a collection of lower-level building blocks for these tasks. Built
47
- on Keras 3, models can be trained and serialized in any framework and re-used
48
- in another without costly migrations.
43
+ **KerasHub** is a pretrained modeling library that aims to be simple, flexible,
44
+ and fast. The library provides [Keras 3](https://keras.io/keras_3/)
45
+ implementations of popular model architectures, paired with a collection of
46
+ pretrained checkpoints available on [Kaggle Models](https://kaggle.com/models/).
47
+ Models can be used with text, image, and audio data for generation, classification,
48
+ and many other built in tasks.
49
49
 
50
- This library is an extension of the core Keras API; all high-level modules are
51
- Layers and Models that receive that same level of polish as core Keras.
52
- If you are familiar with Keras, congratulations! You already understand most of
53
- KerasHub.
50
+ KerasHub is an extension of the core Keras API; KerasHub components are provided
51
+ as `Layer` and `Model` implementations. If you are familiar with Keras,
52
+ congratulations! You already understand most of KerasHub.
54
53
 
55
54
  All models support JAX, TensorFlow, and PyTorch from a single model
56
55
  definition and can be fine-tuned on GPUs and TPUs out of the box. Models can
57
56
  be trained on individual accelerators with built-in PEFT techniques, or
58
57
  fine-tuned at scale with model and data parallel training. See our
59
58
  [Getting Started guide](https://keras.io/guides/keras_hub/getting_started)
60
- to start learning our API. Browse our models on
61
- [Kaggle](https://www.kaggle.com/organizations/keras/models).
62
- We welcome contributions.
59
+ to start learning our API.
63
60
 
64
61
  ## Quick Links
65
62
 
66
63
  ### For everyone
67
64
 
68
- - [Home Page](https://keras.io/keras_hub)
69
- - [Developer Guides](https://keras.io/guides/keras_hub)
70
- - [API Reference](https://keras.io/api/keras_hub)
71
- - [Pre-trained Models](https://www.kaggle.com/organizations/keras/models)
65
+ - [Home page](https://keras.io/keras_hub)
66
+ - [Getting started](https://keras.io/keras_hub/getting_started)
67
+ - [Guides](https://keras.io/keras_hub/guides)
68
+ - [API documentation](https://keras.io/keras_hub/api)
69
+ - [Pre-trained models](https://keras.io/keras_hub/presets/)
72
70
 
73
71
  ### For contributors
74
72
 
73
+ - [Call for Contributions](https://github.com/keras-team/keras-hub/issues/1835)
74
+ - [Roadmap](https://github.com/keras-team/keras-hub/issues/1836)
75
75
  - [Contributing Guide](CONTRIBUTING.md)
76
- - [Roadmap](ROADMAP.md)
77
76
  - [Style Guide](STYLE_GUIDE.md)
78
77
  - [API Design Guide](API_DESIGN_GUIDE.md)
79
- - [Call for Contributions](https://github.com/keras-team/keras-hub/issues?q=is%3Aissue+is%3Aopen+label%3A%22contributions+welcome%22)
80
78
 
81
79
  ## Quickstart
82
80
 
83
- Fine-tune a BERT classifier on IMDb movie reviews:
81
+ Choose a backend:
84
82
 
85
83
  ```python
86
84
  import os
87
85
  os.environ["KERAS_BACKEND"] = "jax" # Or "tensorflow" or "torch"!
86
+ ```
87
+
88
+ Import KerasHub and other libraries:
88
89
 
90
+ ```python
91
+ import keras
89
92
  import keras_hub
93
+ import numpy as np
90
94
  import tensorflow_datasets as tfds
95
+ ```
91
96
 
97
+ Load a resnet model and use it to predict a label for an image:
98
+
99
+ ```python
100
+ classifier = keras_hub.models.ImageClassifier.from_preset(
101
+ "resnet_50_imagenet",
102
+ activation="softmax",
103
+ )
104
+ url = "https://upload.wikimedia.org/wikipedia/commons/a/aa/California_quail.jpg"
105
+ path = keras.utils.get_file(origin=url)
106
+ image = keras.utils.load_img(path)
107
+ preds = classifier.predict(np.array([image]))
108
+ print(keras_hub.utils.decode_imagenet_predictions(preds))
109
+ ```
110
+
111
+ Load a Bert model and fine-tune it on IMDb movie reviews:
112
+
113
+ ```python
114
+ classifier = keras_hub.models.BertClassifier.from_preset(
115
+ "bert_base_en_uncased",
116
+ activation="softmax",
117
+ num_classes=2,
118
+ )
92
119
  imdb_train, imdb_test = tfds.load(
93
120
  "imdb_reviews",
94
121
  split=["train", "test"],
95
122
  as_supervised=True,
96
123
  batch_size=16,
97
124
  )
98
-
99
- # Load a BERT model.
100
- classifier = keras_hub.models.Classifier.from_preset(
101
- "bert_base_en",
102
- num_classes=2,
103
- activation="softmax",
104
- )
105
-
106
- # Fine-tune on IMDb movie reviews.
107
125
  classifier.fit(imdb_train, validation_data=imdb_test)
108
- # Predict two new examples.
109
- classifier.predict(["What an amazing movie!", "A total waste of my time."])
126
+ preds = classifier.predict(["What an amazing movie!", "A total waste of time."])
127
+ print(preds)
110
128
  ```
111
129
 
112
- Try it out [in a colab](https://colab.research.google.com/drive/1gSWkh3yOLwmKAaNh2dQQ6kQIlnGte7P2?usp=sharing).
113
- For more in depth guides and examples, visit
114
- [keras.io/keras_hub](https://keras.io/keras_hub/).
115
-
116
130
  ## Installation
117
131
 
118
- To try out the latest version of KerasHub, you can use
119
- our nightly package:
132
+ To install the latest KerasHub release with Keras 3, simply run:
120
133
 
121
- ```bash
122
- pip install keras-hub
123
134
  ```
135
+ pip install --upgrade keras-hub
136
+ ```
137
+
138
+ To install the latest nightly changes for both KerasHub and Keras, you can use
139
+ our nightly package.
124
140
 
125
- KerasHub currently requires TensorFlow to be installed for use of the
126
- `tf.data` API for preprocessing. Even when pre-processing with `tf.data`,
127
- training can still happen on any backend.
141
+ ```
142
+ pip install --upgrade keras-hub-nightly
143
+ ```
128
144
 
129
- Read [Getting started with Keras](https://keras.io/getting_started/) for more
130
- information on installing Keras 3 and compatibility with different frameworks.
145
+ Currently, installing KerasHub will always pull in TensorFlow for use of the
146
+ `tf.data` API for preprocessing. When pre-processing with `tf.data`, training
147
+ can still happen on any backend.
131
148
 
132
- > [!IMPORTANT]
133
- > We recommend using KerasHub with TensorFlow 2.16 or later, as TF 2.16 packages
134
- > Keras 3 by default.
149
+ Visit the [core Keras getting started page](https://keras.io/getting_started/)
150
+ for more information on installing Keras 3, accelerator support, and
151
+ compatibility with different frameworks.
135
152
 
136
153
  ## Configuring your backend
137
154
 
@@ -9,7 +9,7 @@ keras_hub/api/tokenizers/__init__.py,sha256=_f-r_cyUM2fjBB7iO84ThOdqqsAxHNIewJ2E
9
9
  keras_hub/api/utils/__init__.py,sha256=Gp1E6gG-RtKQS3PBEQEOz9PQvXkXaJ0ySGMqZ7myN7A,215
10
10
  keras_hub/src/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  keras_hub/src/api_export.py,sha256=9pQZK27JObxWZ96QPLBp1OBsjWigh1iuV6RglPGMRk0,1499
12
- keras_hub/src/version_utils.py,sha256=LFMyOeXaNdPJ8scYrtecwIsKZPAhX0lDvD4Q2e4JAGA,222
12
+ keras_hub/src/version_utils.py,sha256=8-CpRBV-iJ355AH_58l91WM8FnBGV_K1hbM7hGV2Ids,222
13
13
  keras_hub/src/bounding_box/__init__.py,sha256=7i6KnGupN4AVivR_dFjQyuuTbI0GkHy8d-aMXeqZdU8,95
14
14
  keras_hub/src/bounding_box/converters.py,sha256=MOBXnjFXCTLVy5BiLrg30atJvlS5Y-9gVAna0M0pzEE,21916
15
15
  keras_hub/src/bounding_box/formats.py,sha256=YmskOz2BOSat7NaE__J9VfpSNGPJJR0znSzA4lp8MMI,3868
@@ -403,7 +403,7 @@ keras_hub/src/utils/transformers/convert_mistral.py,sha256=kVhN9h1ZFVhwkNW8p3wnS
403
403
  keras_hub/src/utils/transformers/convert_pali_gemma.py,sha256=B1leeDw96Yvu81hYumf66hIid07k5NLqoeWAJgPnaLs,10649
404
404
  keras_hub/src/utils/transformers/preset_loader.py,sha256=GS44hZUuGQCtzsyn8z44ZpHdftd3DFemwV2hx2bQa-U,2738
405
405
  keras_hub/src/utils/transformers/safetensor_utils.py,sha256=rPK-Uw1CG0DX0d_UAD-r2cG9fw8GI8bvAlrcXfQ9g4c,3323
406
- keras_hub_nightly-0.19.0.dev202412080355.dist-info/METADATA,sha256=jmaNyBNmZi_YQEmiLUnxKGZsuNbztqqYFARdxVnuy0k,6988
407
- keras_hub_nightly-0.19.0.dev202412080355.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
408
- keras_hub_nightly-0.19.0.dev202412080355.dist-info/top_level.txt,sha256=N4J6piIWBKa38A4uV-CnIopnOEf8mHAbkNXafXm_CuA,10
409
- keras_hub_nightly-0.19.0.dev202412080355.dist-info/RECORD,,
406
+ keras_hub_nightly-0.19.0.dev202412100354.dist-info/METADATA,sha256=-Llij_U8wlzQdzI2V7klkO2ryOI0CoA3mP3Ik1sXQM8,7263
407
+ keras_hub_nightly-0.19.0.dev202412100354.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
408
+ keras_hub_nightly-0.19.0.dev202412100354.dist-info/top_level.txt,sha256=N4J6piIWBKa38A4uV-CnIopnOEf8mHAbkNXafXm_CuA,10
409
+ keras_hub_nightly-0.19.0.dev202412100354.dist-info/RECORD,,