Keras_Core_introduction.pptx

G
Keras Core
Keras for TensorFlow, JAX, and PyTorch
Multi-backend Keras is back
● Full rewrite of Keras
○ Now only 45k loc instead of 135k
● Support for TensorFlow, JAX, PyTorch, NumPy backends
○ NumPy backend is inference-only
● Drop-in replacement for tf.keras when using TensorFlow backend
○ Just change your imports!
● XLA compilation by default in TF and JAX (soon PyTorch?)
Keras_Core_introduction.pptx
Develop cross-framework components with keras.ops
● Includes the NumPy API – same functions, same arguments.
○ ops.matmul, ops.sum, ops.stack, ops.einsum, etc.
● Plus neural network-specific functions absent from NumPy
○ ops.softmax, ops.binary_crossentropy, ops.conv, etc.
● Models / layers / losses / metrics / optimizers written with Keras APIs
work the same with any framework
○ They can even be used outside of Keras workflows!
Keras_Core_introduction.pptx
Keras_Core_introduction.pptx
Seamless integration with backend-native workflows
● Write a low-level JAX training loop to train a Keras model
○ e.g. optax optimizer, jax.grad, jax.jit, jax.pmap…
● Write a low-level TensorFlow training loop to train a Keras model
○ e.g. tf.GradientTape & tf.distribute.
● Write a low-level PyTorch training loop to train a Keras model
○ e.g. torch.optim optimizer, torch loss function,
torch.nn.parallel.DistributedDataParallel
● Use a Keras layer or model as part of a torch.nn.Module.
○ PyTorch users can start leveraging Keras models whether or not they use Keras APIs!
You can treat a Keras model just like any other PyTorch Module.
● etc.
Writing a custom training loop for a Keras model
Progressive disclosure of complexity
● Start simple, then gradually gain arbitrary flexibility by "opening up
the box"
● Example: model training
○ fit → callbacks → custom train_step → custom training loop
● Example: model building
○ Sequential → Functional → Functional with custom layers → subclassed model
● etc.
● Makes Keras suitable for students AND for Waymo engineers
Keras_Core_introduction.pptx
Pretrained models
Keras Core includes all Keras Applications (popular image classifiers)
KerasCV and KerasNLP work out of the box with Keras Core and all
backends as of the latest releases
● YOLOv8
● Whisper
● BERT
● OPT
● Stable Diffusion
● etc.
Keras multi-backend distribute API
Lightweight data parallel / model parallel distribution API built on top of:
● jax.sharding (link) - ready
● PyTorch/XLA sharding (link) - coming soon
● TensorFlow DTensor (link) - coming soon
All the heavy lifting is already done in XLA GSPMD !
Main class:
LayoutMap: encapsulates sharding for your Keras model
Other API classes map directly onto backend primitives:
DeviceMesh → jax.sharding.Mesh
TensorLayout → jax.sharding.NamedSharding
Specify sharding / replication for your Keras model (from OPT2 Keras distributed example)
Users can also train their Keras models using:
● A custom training loop
● Backend-specific distribution APIs directly
Demo: go/keras-multi-backend-demo section “JAX-native distribution”
Keras multi-backend distribute API: roadmap
● Jax.sharding implementation - DONE
● Model saving and checkpointing for distributed models - DONE
● Utility for distributing datasets (multi-backend equivalent of
tf.distribute.Strategy.distribute_datasets_from_function
● Sharding constraints on intermediate values
(equivalent of jax.lax.with_sharding_constraint)
● MultiSlice capability (jax.experimental.mesh_utils.create_hybrid_device_mesh)
● PyTorch/XLA sharding implementation
● TensorFlow DTensor implementation
Why Keras Core?
● Maximize performance
○ Pick the backend that's the fastest for your particular model
○ Typically, PyTorch < TensorFlow < JAX (by 10-20% jumps between frameworks)
● Maximize available ecosystem surface
○ Export your model to TF SavedModel (TFLite, TF.js, TF Serving, TF-MOT, etc.)
○ Instantiate your model as a PyTorch Module and use it with the PyTorch ecosystem
○ Call your model as a stateless JAX function and use it with JAX transforms
● Maximize addressable market for your OSS model releases
○ PyTorch, TF have only 40-60% of the market each
○ Keras models are usable by anyone with no framework lock-in
● Maximize data source availability
○ Use tf.data, PyTorch DataLoader, NumPy, Pandas, etc. – with any backend
Wait, there's more!
● Access to 2.5M established user base
○ Will smoothly transition from tf.keras to Keras Core
● Maximum usability / accessibility, high user satisfaction ratings
○ Copied many times, never matched
● Model and checkpoint portability
○ From tf.keras and across different backends
● Future-proof your models
Keras = future-proof stability
If you were a Theano user in 2016, you had to migrate to TF 1…
… but if you were a Keras user on top of Theano, you got TF 1 nearly for free
If you were a TF 1 user in 2019, you had to migrate to TF 2…
… but if you were a Keras user on top of TF 1, you got TF 2 nearly for free
If you are using Keras on top of TF 2 in 2023…
… you get JAX and PyTorch support nearly for free
And so on going forward (Mojo next?)
Frameworks are transient, Keras is your rock.
Questions
1 von 20

Recomendados

TensorFlow meetup: Keras - Pytorch - TensorFlow.js von
TensorFlow meetup: Keras - Pytorch - TensorFlow.jsTensorFlow meetup: Keras - Pytorch - TensorFlow.js
TensorFlow meetup: Keras - Pytorch - TensorFlow.jsStijn Decubber
570 views99 Folien
Impala presentation ahad rana von
Impala presentation ahad ranaImpala presentation ahad rana
Impala presentation ahad ranaData Con LA
1.1K views25 Folien
TensorFlow and Keras: An Overview von
TensorFlow and Keras: An OverviewTensorFlow and Keras: An Overview
TensorFlow and Keras: An OverviewPoo Kuan Hoong
2.5K views28 Folien
TensorFlowOnSpark: Scalable TensorFlow Learning on Spark Clusters von
TensorFlowOnSpark: Scalable TensorFlow Learning on Spark ClustersTensorFlowOnSpark: Scalable TensorFlow Learning on Spark Clusters
TensorFlowOnSpark: Scalable TensorFlow Learning on Spark ClustersDataWorks Summit
5K views37 Folien
running Tensorflow in Production von
running Tensorflow in Productionrunning Tensorflow in Production
running Tensorflow in ProductionMatthias Feys
4.2K views78 Folien
Keras: Deep Learning Library for Python von
Keras: Deep Learning Library for PythonKeras: Deep Learning Library for Python
Keras: Deep Learning Library for PythonRafi Khan
1.3K views10 Folien

Más contenido relacionado

Similar a Keras_Core_introduction.pptx

Hopsworks at Google AI Huddle, Sunnyvale von
Hopsworks at Google AI Huddle, SunnyvaleHopsworks at Google AI Huddle, Sunnyvale
Hopsworks at Google AI Huddle, SunnyvaleJim Dowling
484 views74 Folien
Standardizing on a single N-dimensional array API for Python von
Standardizing on a single N-dimensional array API for PythonStandardizing on a single N-dimensional array API for Python
Standardizing on a single N-dimensional array API for PythonRalf Gommers
119 views14 Folien
Deep Learning on ARM Platforms - SFO17-509 von
Deep Learning on ARM Platforms - SFO17-509Deep Learning on ARM Platforms - SFO17-509
Deep Learning on ARM Platforms - SFO17-509Linaro
5.3K views17 Folien
Using the FLiPN Stack for Edge AI (Flink, NiFi, Pulsar) von
Using the FLiPN Stack for Edge AI (Flink, NiFi, Pulsar) Using the FLiPN Stack for Edge AI (Flink, NiFi, Pulsar)
Using the FLiPN Stack for Edge AI (Flink, NiFi, Pulsar) Timothy Spann
304 views71 Folien
Large Scale ETL for Hadoop and Cloudera Search using Morphlines von
Large Scale ETL for Hadoop and Cloudera Search using MorphlinesLarge Scale ETL for Hadoop and Cloudera Search using Morphlines
Large Scale ETL for Hadoop and Cloudera Search using Morphlineswhoschek
2.1K views36 Folien
Data processing platforms with SMACK: Spark and Mesos internals von
Data processing platforms with SMACK:  Spark and Mesos internalsData processing platforms with SMACK:  Spark and Mesos internals
Data processing platforms with SMACK: Spark and Mesos internalsAnton Kirillov
4K views62 Folien

Similar a Keras_Core_introduction.pptx(20)

Hopsworks at Google AI Huddle, Sunnyvale von Jim Dowling
Hopsworks at Google AI Huddle, SunnyvaleHopsworks at Google AI Huddle, Sunnyvale
Hopsworks at Google AI Huddle, Sunnyvale
Jim Dowling484 views
Standardizing on a single N-dimensional array API for Python von Ralf Gommers
Standardizing on a single N-dimensional array API for PythonStandardizing on a single N-dimensional array API for Python
Standardizing on a single N-dimensional array API for Python
Ralf Gommers119 views
Deep Learning on ARM Platforms - SFO17-509 von Linaro
Deep Learning on ARM Platforms - SFO17-509Deep Learning on ARM Platforms - SFO17-509
Deep Learning on ARM Platforms - SFO17-509
Linaro5.3K views
Using the FLiPN Stack for Edge AI (Flink, NiFi, Pulsar) von Timothy Spann
Using the FLiPN Stack for Edge AI (Flink, NiFi, Pulsar) Using the FLiPN Stack for Edge AI (Flink, NiFi, Pulsar)
Using the FLiPN Stack for Edge AI (Flink, NiFi, Pulsar)
Timothy Spann304 views
Large Scale ETL for Hadoop and Cloudera Search using Morphlines von whoschek
Large Scale ETL for Hadoop and Cloudera Search using MorphlinesLarge Scale ETL for Hadoop and Cloudera Search using Morphlines
Large Scale ETL for Hadoop and Cloudera Search using Morphlines
whoschek2.1K views
Data processing platforms with SMACK: Spark and Mesos internals von Anton Kirillov
Data processing platforms with SMACK:  Spark and Mesos internalsData processing platforms with SMACK:  Spark and Mesos internals
Data processing platforms with SMACK: Spark and Mesos internals
Anton Kirillov4K views
Guglielmo iozzia - Google I/O extended dublin 2018 von Guglielmo Iozzia
Guglielmo iozzia - Google  I/O extended dublin 2018Guglielmo iozzia - Google  I/O extended dublin 2018
Guglielmo iozzia - Google I/O extended dublin 2018
Guglielmo Iozzia115 views
Embrace Sparsity At Web Scale: Apache Spark MLlib Algorithms Optimization For... von Jen Aman
Embrace Sparsity At Web Scale: Apache Spark MLlib Algorithms Optimization For...Embrace Sparsity At Web Scale: Apache Spark MLlib Algorithms Optimization For...
Embrace Sparsity At Web Scale: Apache Spark MLlib Algorithms Optimization For...
Jen Aman1.9K views
Building Large Scale Machine Learning Applications with Pipelines-(Evan Spark... von Spark Summit
Building Large Scale Machine Learning Applications with Pipelines-(Evan Spark...Building Large Scale Machine Learning Applications with Pipelines-(Evan Spark...
Building Large Scale Machine Learning Applications with Pipelines-(Evan Spark...
Spark Summit5.1K views
MVAPICH2 and MVAPICH2-X Projects: Latest Developments and Future Plans von inside-BigData.com
MVAPICH2 and MVAPICH2-X Projects: Latest Developments and Future PlansMVAPICH2 and MVAPICH2-X Projects: Latest Developments and Future Plans
MVAPICH2 and MVAPICH2-X Projects: Latest Developments and Future Plans
inside-BigData.com3.2K views
Optimize + Deploy Distributed Tensorflow, Spark, and Scikit-Learn Models on G... von Chris Fregly
Optimize + Deploy Distributed Tensorflow, Spark, and Scikit-Learn Models on G...Optimize + Deploy Distributed Tensorflow, Spark, and Scikit-Learn Models on G...
Optimize + Deploy Distributed Tensorflow, Spark, and Scikit-Learn Models on G...
Chris Fregly1.5K views
Johnny Miller – Cassandra + Spark = Awesome- NoSQL matters Barcelona 2014 von NoSQLmatters
Johnny Miller – Cassandra + Spark = Awesome- NoSQL matters Barcelona 2014Johnny Miller – Cassandra + Spark = Awesome- NoSQL matters Barcelona 2014
Johnny Miller – Cassandra + Spark = Awesome- NoSQL matters Barcelona 2014
NoSQLmatters2.4K views
Machine learning from software developers point of view von Pierre Paci
Machine learning from software developers point of viewMachine learning from software developers point of view
Machine learning from software developers point of view
Pierre Paci489 views
A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ... von Jose Quesada (hiring)
A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...
A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...
Jose Quesada (hiring)10.1K views
Using MXNet to Train and Deploy your Deep Learning Model von Qing Lan
Using MXNet to Train and Deploy your Deep Learning ModelUsing MXNet to Train and Deploy your Deep Learning Model
Using MXNet to Train and Deploy your Deep Learning Model
Qing Lan67 views
AI and Spark - IBM Community AI Day von Nick Pentreath
AI and Spark - IBM Community AI DayAI and Spark - IBM Community AI Day
AI and Spark - IBM Community AI Day
Nick Pentreath118 views

Último

Vikas 500 BIG DATA TECHNOLOGIES LAB.pdf von
Vikas 500 BIG DATA TECHNOLOGIES LAB.pdfVikas 500 BIG DATA TECHNOLOGIES LAB.pdf
Vikas 500 BIG DATA TECHNOLOGIES LAB.pdfvikas12611618
8 views30 Folien
Journey of Generative AI von
Journey of Generative AIJourney of Generative AI
Journey of Generative AIthomasjvarghese49
30 views37 Folien
PROGRAMME.pdf von
PROGRAMME.pdfPROGRAMME.pdf
PROGRAMME.pdfHiNedHaJar
17 views13 Folien
Survey on Factuality in LLM's.pptx von
Survey on Factuality in LLM's.pptxSurvey on Factuality in LLM's.pptx
Survey on Factuality in LLM's.pptxNeethaSherra1
5 views9 Folien
Launch of the Knowledge Exchange Platform - Romina Boarini - 21 November 2023 von
Launch of the Knowledge Exchange Platform - Romina Boarini - 21 November 2023Launch of the Knowledge Exchange Platform - Romina Boarini - 21 November 2023
Launch of the Knowledge Exchange Platform - Romina Boarini - 21 November 2023StatsCommunications
55 views5 Folien
Building Real-Time Travel Alerts von
Building Real-Time Travel AlertsBuilding Real-Time Travel Alerts
Building Real-Time Travel AlertsTimothy Spann
109 views48 Folien

Último(20)

Vikas 500 BIG DATA TECHNOLOGIES LAB.pdf von vikas12611618
Vikas 500 BIG DATA TECHNOLOGIES LAB.pdfVikas 500 BIG DATA TECHNOLOGIES LAB.pdf
Vikas 500 BIG DATA TECHNOLOGIES LAB.pdf
vikas126116188 views
Survey on Factuality in LLM's.pptx von NeethaSherra1
Survey on Factuality in LLM's.pptxSurvey on Factuality in LLM's.pptx
Survey on Factuality in LLM's.pptx
NeethaSherra15 views
Launch of the Knowledge Exchange Platform - Romina Boarini - 21 November 2023 von StatsCommunications
Launch of the Knowledge Exchange Platform - Romina Boarini - 21 November 2023Launch of the Knowledge Exchange Platform - Romina Boarini - 21 November 2023
Launch of the Knowledge Exchange Platform - Romina Boarini - 21 November 2023
Building Real-Time Travel Alerts von Timothy Spann
Building Real-Time Travel AlertsBuilding Real-Time Travel Alerts
Building Real-Time Travel Alerts
Timothy Spann109 views
Data structure and algorithm. von Abdul salam
Data structure and algorithm. Data structure and algorithm.
Data structure and algorithm.
Abdul salam 18 views
Supercharging your Data with Azure AI Search and Azure OpenAI von Peter Gallagher
Supercharging your Data with Azure AI Search and Azure OpenAISupercharging your Data with Azure AI Search and Azure OpenAI
Supercharging your Data with Azure AI Search and Azure OpenAI
Peter Gallagher37 views
Cross-network in Google Analytics 4.pdf von GA4 Tutorials
Cross-network in Google Analytics 4.pdfCross-network in Google Analytics 4.pdf
Cross-network in Google Analytics 4.pdf
GA4 Tutorials6 views
Understanding Hallucinations in LLMs - 2023 09 29.pptx von Greg Makowski
Understanding Hallucinations in LLMs - 2023 09 29.pptxUnderstanding Hallucinations in LLMs - 2023 09 29.pptx
Understanding Hallucinations in LLMs - 2023 09 29.pptx
Greg Makowski13 views
JConWorld_ Continuous SQL with Kafka and Flink von Timothy Spann
JConWorld_ Continuous SQL with Kafka and FlinkJConWorld_ Continuous SQL with Kafka and Flink
JConWorld_ Continuous SQL with Kafka and Flink
Timothy Spann100 views
Short Story Assignment by Kelly Nguyen von kellynguyen01
Short Story Assignment by Kelly NguyenShort Story Assignment by Kelly Nguyen
Short Story Assignment by Kelly Nguyen
kellynguyen0118 views
Chapter 3b- Process Communication (1) (1)(1) (1).pptx von ayeshabaig2004
Chapter 3b- Process Communication (1) (1)(1) (1).pptxChapter 3b- Process Communication (1) (1)(1) (1).pptx
Chapter 3b- Process Communication (1) (1)(1) (1).pptx
ayeshabaig20045 views
Organic Shopping in Google Analytics 4.pdf von GA4 Tutorials
Organic Shopping in Google Analytics 4.pdfOrganic Shopping in Google Analytics 4.pdf
Organic Shopping in Google Analytics 4.pdf
GA4 Tutorials10 views
Advanced_Recommendation_Systems_Presentation.pptx von neeharikasingh29
Advanced_Recommendation_Systems_Presentation.pptxAdvanced_Recommendation_Systems_Presentation.pptx
Advanced_Recommendation_Systems_Presentation.pptx

Keras_Core_introduction.pptx

  • 1. Keras Core Keras for TensorFlow, JAX, and PyTorch
  • 2. Multi-backend Keras is back ● Full rewrite of Keras ○ Now only 45k loc instead of 135k ● Support for TensorFlow, JAX, PyTorch, NumPy backends ○ NumPy backend is inference-only ● Drop-in replacement for tf.keras when using TensorFlow backend ○ Just change your imports! ● XLA compilation by default in TF and JAX (soon PyTorch?)
  • 4. Develop cross-framework components with keras.ops ● Includes the NumPy API – same functions, same arguments. ○ ops.matmul, ops.sum, ops.stack, ops.einsum, etc. ● Plus neural network-specific functions absent from NumPy ○ ops.softmax, ops.binary_crossentropy, ops.conv, etc. ● Models / layers / losses / metrics / optimizers written with Keras APIs work the same with any framework ○ They can even be used outside of Keras workflows!
  • 7. Seamless integration with backend-native workflows ● Write a low-level JAX training loop to train a Keras model ○ e.g. optax optimizer, jax.grad, jax.jit, jax.pmap… ● Write a low-level TensorFlow training loop to train a Keras model ○ e.g. tf.GradientTape & tf.distribute. ● Write a low-level PyTorch training loop to train a Keras model ○ e.g. torch.optim optimizer, torch loss function, torch.nn.parallel.DistributedDataParallel ● Use a Keras layer or model as part of a torch.nn.Module. ○ PyTorch users can start leveraging Keras models whether or not they use Keras APIs! You can treat a Keras model just like any other PyTorch Module. ● etc.
  • 8. Writing a custom training loop for a Keras model
  • 9. Progressive disclosure of complexity ● Start simple, then gradually gain arbitrary flexibility by "opening up the box" ● Example: model training ○ fit → callbacks → custom train_step → custom training loop ● Example: model building ○ Sequential → Functional → Functional with custom layers → subclassed model ● etc. ● Makes Keras suitable for students AND for Waymo engineers
  • 11. Pretrained models Keras Core includes all Keras Applications (popular image classifiers) KerasCV and KerasNLP work out of the box with Keras Core and all backends as of the latest releases ● YOLOv8 ● Whisper ● BERT ● OPT ● Stable Diffusion ● etc.
  • 12. Keras multi-backend distribute API Lightweight data parallel / model parallel distribution API built on top of: ● jax.sharding (link) - ready ● PyTorch/XLA sharding (link) - coming soon ● TensorFlow DTensor (link) - coming soon All the heavy lifting is already done in XLA GSPMD !
  • 13. Main class: LayoutMap: encapsulates sharding for your Keras model Other API classes map directly onto backend primitives: DeviceMesh → jax.sharding.Mesh TensorLayout → jax.sharding.NamedSharding
  • 14. Specify sharding / replication for your Keras model (from OPT2 Keras distributed example)
  • 15. Users can also train their Keras models using: ● A custom training loop ● Backend-specific distribution APIs directly Demo: go/keras-multi-backend-demo section “JAX-native distribution”
  • 16. Keras multi-backend distribute API: roadmap ● Jax.sharding implementation - DONE ● Model saving and checkpointing for distributed models - DONE ● Utility for distributing datasets (multi-backend equivalent of tf.distribute.Strategy.distribute_datasets_from_function ● Sharding constraints on intermediate values (equivalent of jax.lax.with_sharding_constraint) ● MultiSlice capability (jax.experimental.mesh_utils.create_hybrid_device_mesh) ● PyTorch/XLA sharding implementation ● TensorFlow DTensor implementation
  • 17. Why Keras Core? ● Maximize performance ○ Pick the backend that's the fastest for your particular model ○ Typically, PyTorch < TensorFlow < JAX (by 10-20% jumps between frameworks) ● Maximize available ecosystem surface ○ Export your model to TF SavedModel (TFLite, TF.js, TF Serving, TF-MOT, etc.) ○ Instantiate your model as a PyTorch Module and use it with the PyTorch ecosystem ○ Call your model as a stateless JAX function and use it with JAX transforms ● Maximize addressable market for your OSS model releases ○ PyTorch, TF have only 40-60% of the market each ○ Keras models are usable by anyone with no framework lock-in ● Maximize data source availability ○ Use tf.data, PyTorch DataLoader, NumPy, Pandas, etc. – with any backend
  • 18. Wait, there's more! ● Access to 2.5M established user base ○ Will smoothly transition from tf.keras to Keras Core ● Maximum usability / accessibility, high user satisfaction ratings ○ Copied many times, never matched ● Model and checkpoint portability ○ From tf.keras and across different backends ● Future-proof your models
  • 19. Keras = future-proof stability If you were a Theano user in 2016, you had to migrate to TF 1… … but if you were a Keras user on top of Theano, you got TF 1 nearly for free If you were a TF 1 user in 2019, you had to migrate to TF 2… … but if you were a Keras user on top of TF 1, you got TF 2 nearly for free If you are using Keras on top of TF 2 in 2023… … you get JAX and PyTorch support nearly for free And so on going forward (Mojo next?) Frameworks are transient, Keras is your rock.

Hinweis der Redaktion

  1. Keras is the most lindy thing in deep learning: it survived literally every other tool that existed when it launched in 2015.