From 37cc91e1d2cdbd61cc65d05b15cf1633af64ab76 Mon Sep 17 00:00:00 2001 From: Tomasz Kalinowski Date: Thu, 16 May 2024 10:15:23 -0400 Subject: [PATCH 1/6] First draft --- _posts/2024-05-21-keras3/images/preview.png | Bin 0 -> 25263 bytes .../2024-05-21-keras3/introducing-keras3.Rmd | 323 ++++++++++++++++++ 2 files changed, 323 insertions(+) create mode 100644 _posts/2024-05-21-keras3/images/preview.png create mode 100644 _posts/2024-05-21-keras3/introducing-keras3.Rmd diff --git a/_posts/2024-05-21-keras3/images/preview.png b/_posts/2024-05-21-keras3/images/preview.png new file mode 100644 index 0000000000000000000000000000000000000000..6295d27007a7622c3415dc2a8a01f89fab3404d7 GIT binary patch literal 25263 zcmdSB1yt7Sw>A0#f|SyNinP-3(%nd@w3Kvrmq<4XiXfl@QX(a(fD%$lDk0Jh1|g+% ze(Q&O?{m&K&i|bA-S3V&#$~wO!263Q*P3h2`52?Fs(1$f0zL|bI-{&4uZcoo;h<0$ zXK>+fROK^wN%$Y0tCGG43PnJM{D*;hnnr~};eWK#*7MZ6ab48H#fi(z(#710%h$;j zu12B6rF>n@EF7#n>CCNc?3^VSR%;s==?x#K~4)EegQfm5iTAlSfdLA1%tuOZV3o1H8@M(ppqg zUg58I!A}wlww|7@qTJj*K0aJNd|WQ>HrzZSA|l*qUT$7qPPl^8P>nJ=fa2jkyQ zkhk)%aJO^yv~zK$L!M}6?&9Ss!2m7&(*-Bje;(`X@z*fHfN}epxpMPxp^+|~Txe#r0MSu0}KfT&R z`?jkUx2Bbciwfh&BBA@(osjH}*yOo)zi@Uaqi{syGNB!@%(aFgnYej&L<%XGs zoioy4R;2fT-DM?j=4mCt09Occ^6+q?1+;m1Mfv$f`2;!9!lG#OpG$AR`m{9jH2eEv zUNl?@>rR`8UsQlc6b%;({oBPZmUh;+|JzF~Ekvzd+?~u|_UxR@Y^=Cloo!CucH@Sq zva^S$nX`qJvb+QXG?mNF&QjFUlF!_d-%N;;-&|0bli!lpoK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*&mu(%OE78ZVhvKgPbO$=Dn3dWbX zcAl;a%4OnL080QxDg|43~SN7?}!$aMS zg62DZ=DI}PZet^lQ>EM;&i38wE1gsZS-|%Ce7Jpo@ zLUl(V2pPmsEdf<|5FaQ~sgZrTVM(yckZ2tT2Ng&Ji0bCiqa8$vhxHKz+OXW?DU^B^ z!w!*DZ8$1<8;6F9N9aFmOn#&d8`Mw|B6So$xFu+Doe!xEzM5B{7(bGF-y3?-9Nc{P zeEK7kkb1(C48aWZa%I4#`2g6O_yRQhrYdZK*Z~EboCBiTn`IV>mADR3cl`YJ+_K4S zt4Do;jlyTGpN{<ZbQ>!)uPO4^rfj3R;*C zX&s!xy;xNavaV@kc8b3xOdn3kZb=f+ZDAJ0pTCBW{;#Q`|5tIBpD9tbYZZMPXMV@h zoVvca4BW|p*2vrD8!s)@I$JV$BDG}MP(*q$3+iE45ue3+AL*S#_?{2{o9KE*>qqjps;d79i(UVD hGG#y0)32YEdvoXD`O_QIG|7J{VYk)6y2R2i`QH-CGXVeq literal 0 HcmV?d00001 diff --git a/_posts/2024-05-21-keras3/introducing-keras3.Rmd b/_posts/2024-05-21-keras3/introducing-keras3.Rmd new file mode 100644 index 00000000..e820d763 --- /dev/null +++ b/_posts/2024-05-21-keras3/introducing-keras3.Rmd @@ -0,0 +1,323 @@ +--- +title: "Introducing Keras 3 for R" +description: > + We are thrilled to introduce `keras3`, the next version of the Keras R + package. `keras3` is a ground-up rebuild of `{keras}`, maintaining the + beloved features of the original while refining and simplifying the API + based on valuable insights gathered over the past few years. +author: + - name: Tomasz Kalinowski + affiliation: Posit + affiliation_url: https://www.posit.co/ +slug: kalinowskikeras3 +date: 2024-05-21 +output: + distill::distill_article: + self_contained: false + toc: true +categories: + - TensorFlow/Keras + - R +preview: images/preview.png +--- + +We are thrilled to introduce `keras3`, the next version of the Keras R +package. `keras3` is a ground-up rebuild of `{keras}`, maintaining the +beloved features of the original while refining and simplifying the API +based on valuable insights gathered over the past few years. + +Keras provides a complete toolkit for building deep learning models in +R---it's never been easier to build, train, evaluate and deploy deep +learning models. + +## Installation + +To install Keras 3: + +``` r +install.packages("keras3") +library(keras3) +install_keras() +``` + +## What's new: + +### Documentation + +Great documentation is essential, and we've worked hard to make sure +that `keras3` has excellent documentation, both now, and in the future. + +Keras 3 comes with a full refresh of the website: +. There, you will find guides, tutorials, +reference pages with rendered examples, and a new examples gallery. All +the reference pages and guides are also available via R's built-in help +system. + +In a fast moving ecosystem like deep learning, creating great +documentation and wrappers once is not enough. There also need to be +workflows that ensure the documentation is up-to-date with upstream +dependencies. To accomplish this, {keras3} includes two new maintainer +features that ensure the R documentation and function wrappers will stay +up-to-date: + +- We now take snapshots of the upstream documentation and API surface. + With each release, all R documentation is rebased on upstream + updates. This workflow ensures that all R documentation (guides, + examples, vignettes, and reference pages) and R function signatures + stay up-to-date with upstream. This snapshot+rebase functionality is + implemented in a standalone R package, + [{doctether}](https://github.com/t-kalinowski/doctether) + +- All examples and vignettes can now be evaluated and rendered during + a package build. This ensures that no stale or broken example code + makes it into a release. The also means that all user facing example + code now additionally serves as an extended suite of snapshot unit + and integration tests. + + Evaluating code in vignettes and examples continues to be forbidden + by to CRAN restrictions. We work around the CRAN restriction by + adding additional package build steps that pre-render + [examples](https://github.com/rstudio/keras/blob/main/man/roxygen/meta.R) + and + [vignettes](https://github.com/rstudio/keras/blob/main/tools/knit.R). + +Combined, these two features will make it substantially easier for Keras +in R to maintain feature parity and up-to-date documentation with the +Python API to Keras. + +### Multi-backend support + +Keras v1 started life as a library that worked with multiple backends. +Back then, TensorFlow, Theano, and Caffe were the most popular +frameworks for deep learning, and the frameworks that Keras supported. +Over time, the landscape shifted; Theano and Caffe were retired, and +TensorFlow surged in popularity. With Keras v2, TensorFlow became the +premier and only supported backend. Now, the landscape has shifted +again. + +Keras 3 brings the return of multi-backend support. Choose a backend by +calling: + +``` r +use_backend("jax") # or "tensorflow", "torch", "numpy" +``` + +The default backend continues to be TensorFlow, which is the best choice +for most users today; for small-to-medium sized models this is still the +fastest backend. However, each backend has different strengths, and +being able to switch easily will let you adapt to changes as your +project, or the frameworks themselves, evolve. + +Today, switching to the Jax backend can, for some model types, bring +substantial speed improvements. Jax is also the only backend that has +support for a new model parallelism distributed training API. Switching +to Torch can be helpful during development, often producing simpler +trackbacks while debugging. + +Keras 3 also lets you incorporate any pre-existing Torch, Jax, or Flax +module as a standard Keras layer by using the appropriate wrapper, +letting you build atop existing projects with Keras. For example, train +a Torch model using the Keras high-level training (`compile()` + +`fit()`), or include a Flax module as a component of a larger Keras +model. The new multi-backend support lets you use Keras a la carte. + +### The 'Ops' family + +`keras3` introduces a new "Operations" family of function. The Ops +family, currently with over [200 +functions](https://keras.posit.co/reference/index.html#operations), +provides a comprehensive suite of operations typically needed when +operating on nd-arrays for deep learning. The Operation family +supersedes and greatly expands on the former family of backend functions +prefixed with `k_` in the `keras` package. + +The Ops functions let you write backend-agnostic code. They provide a +uniform API, regardless of if you're working with TensorFlow Tensors, +Jax Arrays, Torch Tensors, Keras Symbolic Tensors, NumPy arrays, or R +arrays. + +The Ops functions: + +- all start with prefix `op_` (e.g., `op_stack()`) +- all are pure functions (they produce no side-effects) +- all use consistent 1-based indexing, and coerce doubles to integers + as needed +- all are safe to use with any backend (tensorflow, jax, torch, numpy) +- all are safe to use in both eager and graph/jit/tracing modes + +The Ops API includes: + +- The entirety of the NumPy API (`numpy.*`) +- The TensorFlow NN API (`tf.nn.*`) +- Common linear algebra functions (A subset of `scipy.linalg.*`) +- A subfamily of image transformers +- A comprehensive set of loss functions +- And more! + +### Ingest tabular data with `layer_feature_space()` + +`keras3` provides a new set of functions for building models that ingest +tabular data: `layer_feature_space()` and a family of feature +transformer functions (prefix, `feature_`) for building keras models +that can work with tabular data, either as inputs to a keras model, or +as preprocessing steps in a data loading pipeline (e.g., a +`tfdatasets::dataset_map()`). + +See the [reference +page](https://keras.posit.co/reference/layer_feature_space.html) and an +example usage in a full [end-to-end +example](https://keras.posit.co/articles/examples/structured_data/structured_data_classification_with_feature_space.html) +to learn more. + +### New Subclassing API + +The subclassing API has been refined and extended to [more Keras +types](https://keras.posit.co/reference/index.html#base-keras-classes). +Define subclasses simply by calling: `Layer()`, `Loss()`, `Metric()`, +`Callback()`, `Constraint()`, `Model()`, and `LearningRateSchedule()`. +Defining `{R6}` proxy classes is no longer necessary. + +Additionally the documentation page for each of the subclassing +functions now contains a comprehensive listing of all the available +attributes and methods for that type. Check out +[`?Layer`](https://keras.posit.co/reference/Layer.html) to see what's +possible. + +### Saving and Export + +Keras 3 brings a new model serialization and export API. It is now much +simpler to save and restore models, and also, to export them for +serving. + +- `save_model()`/`load_model()`:\ + A new high-level file format (extension: `.keras`) for saving and + restoring a full model. + + The file format is backend-agnostic. This means that you can convert + trained models between backends, simply by saving with one backend, + and then loading with another. For example, train a model using Jax, + and then convert to Tensorflow for export. + +- `export_savedmodel()`:\ + Export just the forward pass of a model as a compiled artifact for + inference with [TF + Serving](https://www.tensorflow.org/tfx/guide/serving) or (soon) + [Posit Connect](https://posit.co/products/enterprise/connect/). This + is the easiest way to deploy a Keras model for efficient and + concurrent inference serving, all without any R or Python runtime + dependency. + +- Lower level entry points: + + - `save_model_weights()` / `load_model_weights()`:\ + save just the weights as `.h5` files. + - `save_model_config()` / `load_model_config()`:\ + save just the model architecture as a json file. + +- `register_keras_serializable()`: Registering custom objects to + enable them to be serialized and deserialized. + +- `serialize_keras_object()` / `deserialize_keras_object()`: Convert + any Keras object as an R list of simple types that is safe to + convert to JSON or rds. + +- See the new [Serialization and Saving + vignette](https://keras.posit.co/articles/serialization_and_saving.html) + for more details and examples. + +### New `random` family + +A new family of [random tensor +generators](https://keras.posit.co/reference/index.html#random-tensor-generators). +Like the Ops family, these work with all backends. Additionally, all the +RNG-using methods have support for stateless usage when you pass in a +seed generator. This enables tracing and compilation by frameworks that +have special support for stateless, pure, functions, like Jax. See +[`?random_seed_generator()`](https://keras.posit.co/reference/random_seed_generator.html) +for example usage. + +### Other additions: + +- New [`shape()`](https://keras.posit.co/reference/shape.html) + function, one-stop utility for working with tensor shapes in all + contexts. + +- New and improved `print(model)` and `plot(model)` method. See some + examples of output in the [Functional API + guide](https://keras.posit.co/articles/functional_api.html#extract-and-reuse-nodes-in-the-graph-of-layers) + +- All new `fit()` progress bar and live metrics viewer output, + including new dark-mode support in the RStudio IDE. + +- New [`config` + family](https://keras.posit.co/reference/index.html#configuration), + a curated set of functions for getting and setting Keras global + configurations. + +- All of the other function families have expanded with new members: + + - [Layers](https://keras.posit.co/reference/index.html#layers) + (prefix, `layer_`) + - [Activation + functions](https://keras.posit.co/reference/index.html#activations) + (prefix, `activation_`) + - [Optimizers](https://keras.posit.co/reference/index.html#optimizers) + (prefix, `optimizer_`) + - [Metrics](https://keras.posit.co/reference/index.html#metrics) + (prefix `metric_`) + - [Losses](https://keras.posit.co/reference/index.html#losses) + (prefix `loss_)` + - [Image + preprocesing](https://keras.posit.co/reference/index.html#image-preprocessing) + (prefixes `image_` and `op_image_`) + - [Applications](https://keras.posit.co/reference/index.html#applications) + (prefix, `application_`) + +### Migrating from `{keras}` to `{keras3}` + +`{keras3}` is ultimately a preview of the future `{keras}` package. + +If you're writing new code today, you can start using `{keras3}` right +away. + +If you have legacy code that uses `{keras}`, you are encouraged to +update the code for `{keras3}`. For many high-level API functions, such +as **`layer_dense()`**, **`fit()`**, and **`keras_model()`**, minimal to +no changes are required. However there is a long tail of small changes +that you might need to make when updating code that made use of the +lower-level Keras API. Some of those are documented here: +https://keras.io/guides/migrating_to_keras_3/. + +If you're running into issues or have questions about updating, don't +hesitate to ask on https://github.com/rstudio/keras/issues or +https://github.com/rstudio/keras/discussions. + +The `{keras}` and `{keras3}` packages will coexist while the community +transitions. During the transition, `{keras}` will continue to receive +patch updates for compatibility with Keras v2, which continues to be +published to PyPi under the package name `tf-keras`. + +`{keras3}` is intended as a transition package name. In a future update, +the `{keras}` package will begin emitting a package startup message, +announcing a deprecation period. After a notice period in the `{keras}` +package, `{keras3}` will be renamed to `{keras}`. At that time `{keras}` +(v2) will no longer be supported, and `{keras3}` will be an alias for +`{keras}`. + +## Summary + +In summary, `{keras3}` is a robust update to the Keras R package, +incorporating new features while preserving the ease of use and +functionality of the original. The new multi-backend support, +comprehensive suite of Ops functions, refined model serialization API, +and updated documentation workflows enable users to easily take +advantage of the latest developments in the deep learning community. + +Whether you are a seasoned Keras user or just starting your deep +learning journey, Keras 3 provides the tools and flexibility to build, +train, and deploy models with ease and confidence. As we transition from +Keras 2 to Keras 3, we are committed to supporting the community and +ensuring a smooth migration. We invite you to explore the new features, +check out the updated documentation, and join the conversation on our +GitHub discussions page. Welcome to the next chapter of deep learning in +R with Keras 3! From 5723229d62eea38e75f7d883d6432da9264f28f0 Mon Sep 17 00:00:00 2001 From: Tomasz Kalinowski Date: Thu, 16 May 2024 10:20:10 -0400 Subject: [PATCH 2/6] fix slug formatting --- _posts/2024-05-21-keras3/introducing-keras3.Rmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_posts/2024-05-21-keras3/introducing-keras3.Rmd b/_posts/2024-05-21-keras3/introducing-keras3.Rmd index e820d763..7fff032c 100644 --- a/_posts/2024-05-21-keras3/introducing-keras3.Rmd +++ b/_posts/2024-05-21-keras3/introducing-keras3.Rmd @@ -1,8 +1,8 @@ --- title: "Introducing Keras 3 for R" description: > - We are thrilled to introduce `keras3`, the next version of the Keras R - package. `keras3` is a ground-up rebuild of `{keras}`, maintaining the + We are thrilled to introduce {keras3}, the next version of the Keras R + package. {keras3} is a ground-up rebuild of {keras}, maintaining the beloved features of the original while refining and simplifying the API based on valuable insights gathered over the past few years. author: From 2d3828c7f4f2828d1d77a07aac608b62abdaa143 Mon Sep 17 00:00:00 2001 From: Tomasz Kalinowski Date: Mon, 20 May 2024 08:36:53 -0400 Subject: [PATCH 3/6] Edits --- .../2024-05-21-keras3/introducing-keras3.Rmd | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/_posts/2024-05-21-keras3/introducing-keras3.Rmd b/_posts/2024-05-21-keras3/introducing-keras3.Rmd index 7fff032c..ad31cc39 100644 --- a/_posts/2024-05-21-keras3/introducing-keras3.Rmd +++ b/_posts/2024-05-21-keras3/introducing-keras3.Rmd @@ -64,19 +64,21 @@ up-to-date: With each release, all R documentation is rebased on upstream updates. This workflow ensures that all R documentation (guides, examples, vignettes, and reference pages) and R function signatures - stay up-to-date with upstream. This snapshot+rebase functionality is - implemented in a standalone R package, - [{doctether}](https://github.com/t-kalinowski/doctether) + stay up-to-date with upstream. This snapshot-and-rebase + functionality is implemented in a new standalone R package, + [{doctether}](https://github.com/t-kalinowski/doctether), which may be + useful for R package maintainers needing to keep documentation in + parity with dependencies. - All examples and vignettes can now be evaluated and rendered during a package build. This ensures that no stale or broken example code - makes it into a release. The also means that all user facing example - code now additionally serves as an extended suite of snapshot unit - and integration tests. + makes it into a release. It also means all user facing example code + now additionally serves as an extended suite of snapshot unit and + integration tests. - Evaluating code in vignettes and examples continues to be forbidden - by to CRAN restrictions. We work around the CRAN restriction by - adding additional package build steps that pre-render + Evaluating code in vignettes and examples is still not permitted + according to CRAN restrictions. We work around the CRAN restriction + by adding additional package build steps that pre-render [examples](https://github.com/rstudio/keras/blob/main/man/roxygen/meta.R) and [vignettes](https://github.com/rstudio/keras/blob/main/tools/knit.R). @@ -87,13 +89,12 @@ Python API to Keras. ### Multi-backend support -Keras v1 started life as a library that worked with multiple backends. -Back then, TensorFlow, Theano, and Caffe were the most popular -frameworks for deep learning, and the frameworks that Keras supported. -Over time, the landscape shifted; Theano and Caffe were retired, and -TensorFlow surged in popularity. With Keras v2, TensorFlow became the -premier and only supported backend. Now, the landscape has shifted -again. +Soon after its launch in 2015, Keras featured support for most popular +deep learning frameworks: TensorFlow, Theano, MXNet, and CNTK. Over +time, the landscape shifted; Theano, MXNet, and CNTK were retired, and +TensorFlow surged in popularity. In 2021, three years ago, TensorFlow +became the premier and only supported Keras backend. Now, the landscape +has shifted again. Keras 3 brings the return of multi-backend support. Choose a backend by calling: @@ -286,11 +287,11 @@ as **`layer_dense()`**, **`fit()`**, and **`keras_model()`**, minimal to no changes are required. However there is a long tail of small changes that you might need to make when updating code that made use of the lower-level Keras API. Some of those are documented here: -https://keras.io/guides/migrating_to_keras_3/. +. If you're running into issues or have questions about updating, don't -hesitate to ask on https://github.com/rstudio/keras/issues or -https://github.com/rstudio/keras/discussions. +hesitate to ask on or +. The `{keras}` and `{keras3}` packages will coexist while the community transitions. During the transition, `{keras}` will continue to receive From 53ca798f68f43691294328b5b3b082b54ba2c29d Mon Sep 17 00:00:00 2001 From: Tomasz Kalinowski Date: Mon, 20 May 2024 08:43:15 -0400 Subject: [PATCH 4/6] line wrap --- _posts/2024-05-21-keras3/introducing-keras3.Rmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_posts/2024-05-21-keras3/introducing-keras3.Rmd b/_posts/2024-05-21-keras3/introducing-keras3.Rmd index ad31cc39..14644d81 100644 --- a/_posts/2024-05-21-keras3/introducing-keras3.Rmd +++ b/_posts/2024-05-21-keras3/introducing-keras3.Rmd @@ -66,8 +66,8 @@ up-to-date: examples, vignettes, and reference pages) and R function signatures stay up-to-date with upstream. This snapshot-and-rebase functionality is implemented in a new standalone R package, - [{doctether}](https://github.com/t-kalinowski/doctether), which may be - useful for R package maintainers needing to keep documentation in + [{doctether}](https://github.com/t-kalinowski/doctether), which may + be useful for R package maintainers needing to keep documentation in parity with dependencies. - All examples and vignettes can now be evaluated and rendered during From 1f2301217f3f276eef33131e6a246ff0ce27b534 Mon Sep 17 00:00:00 2001 From: Tomasz Kalinowski Date: Mon, 20 May 2024 13:43:34 -0400 Subject: [PATCH 5/6] minor edits --- .../2024-05-21-keras3/introducing-keras3.Rmd | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/_posts/2024-05-21-keras3/introducing-keras3.Rmd b/_posts/2024-05-21-keras3/introducing-keras3.Rmd index 14644d81..5a158c88 100644 --- a/_posts/2024-05-21-keras3/introducing-keras3.Rmd +++ b/_posts/2024-05-21-keras3/introducing-keras3.Rmd @@ -27,7 +27,7 @@ beloved features of the original while refining and simplifying the API based on valuable insights gathered over the past few years. Keras provides a complete toolkit for building deep learning models in -R---it's never been easier to build, train, evaluate and deploy deep +R---it's never been easier to build, train, evaluate, and deploy deep learning models. ## Installation @@ -118,19 +118,19 @@ trackbacks while debugging. Keras 3 also lets you incorporate any pre-existing Torch, Jax, or Flax module as a standard Keras layer by using the appropriate wrapper, letting you build atop existing projects with Keras. For example, train -a Torch model using the Keras high-level training (`compile()` + +a Torch model using the Keras high-level training API (`compile()` + `fit()`), or include a Flax module as a component of a larger Keras -model. The new multi-backend support lets you use Keras a la carte. +model. The new multi-backend support lets you use Keras à la carte. ### The 'Ops' family -`keras3` introduces a new "Operations" family of function. The Ops +`{keras3}` introduces a new "Operations" family of function. The Ops family, currently with over [200 functions](https://keras.posit.co/reference/index.html#operations), provides a comprehensive suite of operations typically needed when operating on nd-arrays for deep learning. The Operation family supersedes and greatly expands on the former family of backend functions -prefixed with `k_` in the `keras` package. +prefixed with `k_` in the `{keras}` package. The Ops functions let you write backend-agnostic code. They provide a uniform API, regardless of if you're working with TensorFlow Tensors, @@ -215,12 +215,13 @@ serving. - `save_model_config()` / `load_model_config()`:\ save just the model architecture as a json file. -- `register_keras_serializable()`: Registering custom objects to - enable them to be serialized and deserialized. +- `register_keras_serializable()`:\ + Register custom objects to enable them to be serialized and + deserialized. -- `serialize_keras_object()` / `deserialize_keras_object()`: Convert - any Keras object as an R list of simple types that is safe to - convert to JSON or rds. +- `serialize_keras_object()` / `deserialize_keras_object()`:\ + Convert any Keras object to an R list of simple types that is safe + to convert to JSON or rds. - See the new [Serialization and Saving vignette](https://keras.posit.co/articles/serialization_and_saving.html) @@ -245,7 +246,7 @@ for example usage. - New and improved `print(model)` and `plot(model)` method. See some examples of output in the [Functional API - guide](https://keras.posit.co/articles/functional_api.html#extract-and-reuse-nodes-in-the-graph-of-layers) + guide](https://keras.posit.co/articles/functional_api.html) - All new `fit()` progress bar and live metrics viewer output, including new dark-mode support in the RStudio IDE. @@ -283,10 +284,10 @@ away. If you have legacy code that uses `{keras}`, you are encouraged to update the code for `{keras3}`. For many high-level API functions, such -as **`layer_dense()`**, **`fit()`**, and **`keras_model()`**, minimal to -no changes are required. However there is a long tail of small changes -that you might need to make when updating code that made use of the -lower-level Keras API. Some of those are documented here: +as `layer_dense()`, `fit()`, and `keras_model()`, minimal to no changes +are required. However there is a long tail of small changes that you +might need to make when updating code that made use of the lower-level +Keras API. Some of those are documented here: . If you're running into issues or have questions about updating, don't From 58cad3191b7452445fc549f15fa072107f595221 Mon Sep 17 00:00:00 2001 From: Tomasz Kalinowski Date: Wed, 29 May 2024 10:05:19 -0400 Subject: [PATCH 6/6] `{keras3}` is the new permanent name. --- _posts/2024-05-21-keras3/introducing-keras3.Rmd | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/_posts/2024-05-21-keras3/introducing-keras3.Rmd b/_posts/2024-05-21-keras3/introducing-keras3.Rmd index 5a158c88..17857b9f 100644 --- a/_posts/2024-05-21-keras3/introducing-keras3.Rmd +++ b/_posts/2024-05-21-keras3/introducing-keras3.Rmd @@ -277,7 +277,7 @@ for example usage. ### Migrating from `{keras}` to `{keras3}` -`{keras3}` is ultimately a preview of the future `{keras}` package. +`{keras3}` supersedes the `{keras}` package. If you're writing new code today, you can start using `{keras3}` right away. @@ -297,14 +297,8 @@ hesitate to ask on or The `{keras}` and `{keras3}` packages will coexist while the community transitions. During the transition, `{keras}` will continue to receive patch updates for compatibility with Keras v2, which continues to be -published to PyPi under the package name `tf-keras`. - -`{keras3}` is intended as a transition package name. In a future update, -the `{keras}` package will begin emitting a package startup message, -announcing a deprecation period. After a notice period in the `{keras}` -package, `{keras3}` will be renamed to `{keras}`. At that time `{keras}` -(v2) will no longer be supported, and `{keras3}` will be an alias for -`{keras}`. +published to PyPi under the package name `tf-keras`. After `tf-keras` is +no longer maintained, the `{keras}` package will be archived. ## Summary