Skip to main content

Divelet ML — Deep learning, in your browser

Build site Coverage Try xeus-python Try Pyodide Content: CC BY-SA 4.0 Code: Apache 2.0

divelet-ml

divelet for ML: Dive into Deep Learning, adapted for JupyterLite.

divelet-ml is an experimental, browser-native adaptation of the Jupyter notebooks that accompany the book Dive into Deep Learning ("the book" below), designed to make its educational content and interactive examples accessible through JupyterLite without requiring a local Python installation or a remote computation server.

The project aims to preserve the book's chapter structure, mathematical explanations, learning objectives, and exercises while adapting its framework-dependent Python implementations for execution directly in the browser.

Project status: Early development. Chapters 2 to 7 and 9 are adapted in full. In Chapter 8, the models are built and their layer shapes shown, and only 8.5 (batch normalization) trains in the browser. Adapted sections run in the browser with no installation. A section link opens its notebook with the xeus-python kernel; [p] opens it with Pyodide instead.

Section Original
1 Introduction (no code) d2l.ai
2.1 Data Manipulation [p] d2l.ai
2.2 Data Preprocessing [p] d2l.ai
2.3 Linear Algebra [p] d2l.ai
2.4 Calculus [p] d2l.ai
2.5 Automatic Differentiation [p] d2l.ai
Extra: Automatic Differentiation from Scratch [p] Not in the book; adapted from micrograd
2.6 Probability and Statistics [p] d2l.ai
2.7 Documentation [p] d2l.ai
3.1 Linear Regression [p] d2l.ai
3.2 Object-Oriented Design for Implementation [p] d2l.ai
3.3 Synthetic Regression Data [p] d2l.ai
3.4 Linear Regression Implementation from Scratch [p] d2l.ai
3.5 Concise Implementation of Linear Regression [p] d2l.ai
3.6 Generalization [p] d2l.ai
3.7 Weight Decay [p] d2l.ai
4.1 Softmax Regression [p] d2l.ai
4.2 The Image Classification Dataset [p] d2l.ai
4.3 The Base Classification Model [p] d2l.ai
4.4 Softmax Regression Implementation from Scratch [p] d2l.ai
4.5 Concise Implementation of Softmax Regression [p] d2l.ai
4.6 Generalization in Classification [p] d2l.ai
4.7 Environment and Distribution Shift [p] d2l.ai
5.1 Multilayer Perceptrons [p] d2l.ai
5.2 Implementation of Multilayer Perceptrons [p] d2l.ai
5.3 Forward Propagation, Backward Propagation, and Computational Graphs [p] d2l.ai
5.4 Numerical Stability and Initialization [p] d2l.ai
5.5 Generalization in Deep Learning [p] d2l.ai
5.6 Dropout [p] d2l.ai
5.7 Predicting House Prices on Kaggle [p] d2l.ai
6.1 Layers and Modules [p] d2l.ai
6.2 Parameter Management [p] d2l.ai
6.3 Parameter Initialization [p] d2l.ai
6.4 Lazy Initialization [p] d2l.ai
6.5 Custom Layers [p] d2l.ai
6.6 File I/O [p] d2l.ai
6.7 GPUs [p] d2l.ai
7.1 From Fully Connected Layers to Convolutions [p] d2l.ai
7.2 Convolutions for Images [p] d2l.ai
7.3 Padding and Stride [p] d2l.ai
7.4 Multiple Input and Multiple Output Channels [p] d2l.ai
7.5 Pooling [p] d2l.ai
7.6 Convolutional Neural Networks (LeNet) [p] d2l.ai
8.1 Deep Convolutional Neural Networks (AlexNet) [p] d2l.ai
8.2 Networks Using Blocks (VGG) [p] d2l.ai
8.3 Network in Network (NiN) [p] d2l.ai
8.4 Multi-Branch Networks (GoogLeNet) [p] d2l.ai
8.5 Batch Normalization [p] d2l.ai
8.6 Residual Networks (ResNet) and ResNeXt [p] d2l.ai
8.7 Densely Connected Networks (DenseNet) [p] d2l.ai
8.8 Designing Convolution Network Architectures [p] d2l.ai
9.1 Working with Sequences [p] d2l.ai
9.2 Converting Raw Text into Sequence Data [p] d2l.ai
9.3 Language Models [p] d2l.ai
9.4 Recurrent Neural Networks [p] d2l.ai
9.5 Recurrent Neural Network Implementation from Scratch [p] d2l.ai
9.6 Concise Implementation of Recurrent Neural Networks [p] d2l.ai
9.7 Backpropagation Through Time [p] d2l.ai
11.3 Attention Scoring Functions [p] d2l.ai

The notebooks' sources are in content/.

Build the site locally with ./build.sh (needs uv and micromamba).

Python package

The notebooks use divelet_ml, a small NumPy counterpart of the book's d2l library. The site's browser kernels already include it. To use it elsewhere:

pip install divelet-ml
import divelet_ml as d2l

It provides add_to_class, HyperParameters, DataModule, check_shape, the plotting helpers plt, set_figsize, set_axes, plot and show_heatmaps, and the training framework of Chapter 3: ProgressBoard, Module, Trainer, SyntheticRegressionData, SGD, LinearRegressionScratch, LinearRegression, Classifier and SoftmaxRegression, all adapted from the book's d2l/torch.py. ArrayLoader yields minibatches of NumPy arrays in place of PyTorch's DataLoader, and param_grads computes gradients with autograd in place of PyTorch's backward. Its divelet_ml.nn module (from divelet_ml import nn) has NumPy stand-ins for the parts of torch.nn the notebooks use: Module, Dropout, LazyLinear, MSELoss, Sequential, Flatten, ReLU, cross_entropy and softmax; divelet_ml.optim has SGD, in place of torch.optim.SGD. Plots use matplotlib. The package grows only as adapted chapters need more of it. Its code is licensed under the Apache License 2.0; the notebooks are not part of the package.

Motivation

Dive into Deep Learning is an open-source, interactive textbook combining mathematical explanations with executable code.

Its implementations rely primarily on deep learning frameworks such as PyTorch, TensorFlow, JAX, and MXNet. These environments can be difficult to reproduce in a browser-only Python runtime.

divelet-ml explores whether the same educational progression can be maintained using lightweight, browser-compatible implementations.

The objective is not to reproduce the entire deep learning framework ecosystem in the browser, but to make the underlying concepts accessible through executable, pedagogically faithful examples.

Design Principles

  • Educational fidelity: Preserve the book's explanations, mathematical formulations, learning objectives, and exercises wherever possible.
  • Browser-native execution: Run examples entirely in the browser without requiring a remote Python kernel.
  • NumPy first: Prefer NumPy implementations when they adequately illustrate the underlying concepts.
  • Framework independence: Avoid unnecessary dependencies on full deep learning frameworks.
  • Progressive adaptation: Adapt chapters individually, prioritizing educational value and technical feasibility.
  • Reproducibility: Document runtime requirements, implementation differences, and compatibility limitations.

Technical Approach

JupyterLite

divelet-ml targets JupyterLite with two Python execution environments:

  • Pyodide: Python compiled to WebAssembly, with access to a browser-compatible scientific Python ecosystem.
  • xeus-python: A browser-native Python kernel built using WebAssembly.

Compatibility will be evaluated independently for each environment.

NumPy and Deep Learning

Where practical, framework-specific operations will be replaced with NumPy equivalents.

This includes tensor manipulation, linear algebra, probability, optimization, and selected neural network implementations.

Some chapters may require more substantial adaptation, particularly those involving automatic differentiation, GPU acceleration, large datasets, or computationally expensive training.

The goal is to preserve the concepts being taught rather than provide identical framework APIs.

Transformers.js and lmLite

For selected chapters involving modern language models or inference, divelet-ml may explore integration with Transformers.js through lmLite.

lmLite provides Python access to browser-native machine learning inference.

This integration is optional and is not intended to replace the mathematical and algorithmic foundations of the book.

Compatibility

A static audit of the book's source repository drives the adaptation order; reviewing its remaining parser warnings and publishing it are still open. Static analysis does not establish that a chapter runs in JupyterLite: every adapted notebook is validated by a browser smoke test under both kernels, and educational fidelity is reviewed separately.

See ROADMAP.md for the audit and the adaptation plan.

Relationship to Dive into Deep Learning

divelet-ml is an independent adaptation of the original Dive into Deep Learning project.

It is not an official edition of the book and is not affiliated with or endorsed by the original authors.

The project intends to preserve the educational contributions of the book while adapting selected implementations for browser-native execution.

Adapted chapters will identify their original sources and document substantive modifications.

License and Attribution

The original Dive into Deep Learning book content is distributed under the Creative Commons Attribution-ShareAlike 4.0 International License.

Adapted educational content derived from the book will retain the applicable attribution and ShareAlike requirements.

divelet-ml's own source code (the divelet_ml package, build scripts and tests) is licensed under the Apache License 2.0. Third-party materials may be subject to separate licenses; these will be reviewed and their required notices preserved before redistribution.

See CONTENT-LICENSE.md and NOTICE.md for licensing and attribution details.

Feedback and Contributions

divelet-ml is an experimental project exploring browser-native deep learning education.

Feedback is particularly welcome on:

  • The educational usefulness of framework-independent implementations.
  • The fidelity of NumPy adaptations to the book's original examples.
  • JupyterLite compatibility, performance, and runtime limitations.
  • Opportunities for browser-native machine learning beyond traditional Python frameworks.

Please share suggestions, bug reports, and use cases through GitHub Issues. To set up a development environment, run the tests or make a release, see CONTRIBUTING.md.

Metadata

Release files for divelet-ml 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for divelet-ml 0.9.0
File Size Uploaded Provenance Actions
divelet_ml-0.9.0.tar.gz 65.8 kB With provenance Details for divelet_ml-0.9.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for divelet-ml 0.9.0
File Interpreter ABI Platform Actions
divelet_ml-0.9.0-py3-none-any.whl Python 3 none any Details for divelet_ml-0.9.0-py3-none-any.whl

Total release size: 106.8 kB

Release files / divelet_ml-0.9.0.tar.gz

Download URL divelet_ml-0.9.0.tar.gz
Size 65.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f91fc41000dc07baaf469da708e4e5e63ec40e0c46f623b0b36b59f4899d7afe
BLAKE2b-256 checksum
How to use checksums
90505773b8591333a4da50216d1a1ca1b27c0724e52e3724ec3a01e9caa11b95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Release files / divelet_ml-0.9.0-py3-none-any.whl

Download URL divelet_ml-0.9.0-py3-none-any.whl
Size 41.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f711bede386065820b85d092e2f2990851283272c2fb76edef51d6084ef18fc5
BLAKE2b-256 checksum
How to use checksums
0026a2ab8233d910bbbf7478ddc31fa8768d83dac15abbe18b5885afcc31c04d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Security for divelet-ml 0.9.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for divelet_ml-0.9.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page