1. It's extremely readable. Go check out the code yourself! It's only about 500 LoC. I recommend this fork I started which makes the code more idiomatic & adds performance improvements (though the code quality of the original was excellent to start with): github.com/fchollet/stabl…
2. It's fast. How much faster? It depends on your hardware (try switching on `jit_compile` to see if you can get a greater speedup that way). Benchmark it on your system and let me know!
3. It works out of the box on M1 MacBooPros GPUs. Just install the proper requirements `requirements_m1.txt` and get going.
(This required no extra work on the repo.)
4. It can do TPU inference out of the box: just get a TPU VM and add a TPU strategy scope to the code. This can yield a dramatic speedup (and cost reduction) when doing large-batch inference.
5. It can also do multi-GPU inference out of the box (same, with a MirroredStrategy scope). It just... works.
6. You can export the underlying 3 Keras models to TFLite and TF.js.
This means that you can create AI art apps that run on the device (in the browser, with local GPU acceleration, or on an Android / iOS device, also with local hardware acceleration). No server costs!
Sounds exciting? Go try it, fork it, hack it. And if you want to learn more about what it looks like to work with Keras and TensorFlow, go read the code: github.com/fchollet/stabl…
Huge thanks to @divamgupta for creating this port! This is top-quality work that will benefit everyone doing creative AI.
I'm always amazed by the velocity of the open-source community 👍
• • •
Missing some Tweet in this thread? You can try to
force a refresh
It's amazing to me that the year is 2024 and some people still equate task-specific skill and intelligence. There is *no* specific task that cannot be solved *without* intelligence -- all you need a sufficiently complete description of the task (removing all test-time novelty and uncertainty), and you can achieve arbitrary levels of skills while entirely by-passing the problem of intelligence. In the limit, even a simple hashtable can be superhuman at anything.
The "AI" of today still has near-zero (though not exactly zero) intelligence, despite achieving superhuman skill at many tasks.
Here's one thing that AI won't be able to do within five years (if you extrapolate from the excruciatingly slow progress of the past 15 years): acquiring new skills as efficiently as humans, using the same data. The ARC benchmark is an attempt at measuring roughly that.
The point of general intelligence is to make it possible to deal with novelty and uncertainty, which is what our lives are made of. Intelligence is the ability to improvise and adapt in the face of situations you weren't prepared for (either by your evolutionary history or by your past experience) -- to efficiently acquire skills at novel tasks, on the fly.
Many of the people who are concerned with falling birthrates aren't willing to consider the set policies that would address the problem -- aggressive tax breaks for families, free daycare, free education, free healthcare, and building more/denser housing to slash the price of homes.
Most people want children, but can't afford them.
I always found it striking how very rich couples (50M+ net worth) all tend to have over 3 children (and often many more). And how young women always say they want children -- yet in practice they delay family building because they are forced to focus on financial stability and therefore career. When money is not an object, families have 3+ children.
For middle incomes (below 1M/year) fertility goes down as income goes up, because *the cost of raising children increases with income* due to *opportunity cost*. If you make $150k and stand to eventually grow to $300k, you are losing a lot of money by quitting your job to raise children (on top of the prohibitive cost of raising children -- which also goes up as your incomes and thus standards go up). You are thus *more* likely to postpone having children.
Starting at 1M/year, fertility rates rise again. And couples that make 5+M/year get to have the number of children they actually want -- which is almost always more than 3, and quite often 5+.
That memorization (which ML has solely focused on) is not intelligence. And because any task that does not involve significant novelty and uncertainty can be solved via memorization, *skill* is never a sign of intelligence, no matter the task.
Intelligence is found in the ability to pick up new skills quickly & efficiently -- at tasks you weren't prepared for. To improvise, adapt and learn.
Here's a paper you can read about it.
It introduced a formal definition of intelligence, as well as benchmark to capture that definition in practical terms. Although it was developed before the rise of LLMs, current state-of-the-art LLMs such as Gemini Ultra, Claude 3, or GPT-4 are not able to score higher than a few percents on that benchmark.arxiv.org/abs/1911.01547
Finding 1: the fastest backend for a given model typically alternates between XLA-compiled JAX and XLA-compiled TF. Plus, you might want to debug/prototype in PT before training/inferencing with JAX or TF.
The ability to write framework-agnostic models and pick your backend later is a game-changer.
Finding 2: Keras 3 with the best-performing backend outperforms reference native PT implementations (compiled) for all models we tried.
Notably, 5 out of 10 tasks demonstrate speedups exceeding 100%, with a maximum speedup of 340%.
If you're not leveraging this advantage for any large model training run, you're wasting GPU time -- and thus throwing away money.
It doesn't take a whole lot of pondering to figure out that the thesis "humans only seem smart because they're 'trained' on huge amounts of 'data' via their visual system (almost like LLMs!)" doesn't hold any water.
For instance -- congenitally blind people are not less intelligent. Vision isn't fundamental to what makes us human. A rich learning environment is still a rich learning environment when apprehended through restricted sensorimotor modalities.
Humans span an incredibly wide range of sensorimotor affordances. Some are blind, some are deaf, some don't have hands. They might grow up in radically different environments -- some with just three other humans around them, some with thousands. Some with libraries of books, some without any writing.
In the end, though, it doesn't make a huge difference -- all of them become fully-fledged, intelligent humans. Because no matter what, they're all extracting information from the world at a roughly constant rate: the intrinsic rate at which the brain processes information. Which is an infinitesimal fraction of the bandwidth of the human sensorimotor feed.
If your senses are missing something, you'll just report your fixed-rate attention to something else, and won't be much poorer for it.
That's also why the influence of genes on fluid intelligence is overwhelmingly greater than that of the environment. If "training data" was so important, you'd expect environment and education to be critical to intelligence. They aren't. Twins raised in vastly different situations end up about as smart.
Thread: quick API overview of Gemma, the new open-source LLM by Google.
First, let's make sure you have the latest Keras and KerasNLP installed, and let's set up your Kaggle credentials, so you can download the assets from Kaggle.
Next, let's instantiate the model and generate some text. You have access to 2 different sizes, 2B & 7B, and 2 different versions per size: base & instruction-tuned.
The first call will download the weights.
I generally recommend running inference in float16 or bfloat16 (depending on the hardware you're using). You can either globally configure the dtype policy in Keras (do it before creating the model), or pass the `dtype` argument to your model.
Note that operations like softmax will use float32 regardless, for stability.