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 5 are adapted in full. 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
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
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 Assessment

An initial static audit of the book's source repository has been developed to identify:

  • Framework-specific implementations and dependencies.
  • Candidate chapters for direct adaptation.
  • Potential incompatibilities with browser-native Python runtimes.
  • Estimated adaptation effort.
  • Opportunities for alternative browser-native implementations.

The audit distinguishes static compatibility estimates from actual execution results.

Static analysis does not establish that a chapter runs successfully in JupyterLite. Browser execution and educational fidelity must be validated separately.

The initial audit references the book's commit:

23d7a5aecceee57d1292c56e90cce307f183bb0a

Development Plan

Chapters 2 (Preliminaries), 3 (Linear Neural Networks for Regression), 4 (Linear Neural Networks for Classification) and 5 (Multilayer Perceptrons) are adapted in full, together with section 11.3 (Attention Scoring Functions), which tested the approach on a later chapter. Chapters 4 and 5 are the first with a real dataset and longer training: Fashion-MNIST is served from the site, and in the browser the notebooks that train multilayer perceptrons run fewer epochs than the book, as each notebook says.

The PyTorch implementations serve as the primary reference.

Each adaptation is reviewed for educational fidelity, browser compatibility, dependencies, and reproducibility, and runs in the browser under both kernels in CI.

Later chapters follow the results of these.

See ROADMAP.md for further details.

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.5.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.5.0
File Size Uploaded Provenance Actions
divelet_ml-0.5.0.tar.gz 38.0 kB With provenance Details for divelet_ml-0.5.0.tar.gz

Built distribution (wheel)

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

Total release size: 68.0 kB

Release files / divelet_ml-0.5.0.tar.gz

Download URL divelet_ml-0.5.0.tar.gz
Size 38.0 kB
Tags Source
SHA-256 checksum
How to use checksums
53ae4aa290ebdc51a983ac75161d855ab37b60f751ae244cece7b59b8b1faf37
BLAKE2b-256 checksum
How to use checksums
cfcc90c22c75189b58a4992950ee7ce5d3b3f15f103668559834a645262d9631
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 17, 2026.

Transparency log

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

Download URL divelet_ml-0.5.0-py3-none-any.whl
Size 30.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
19d4783e96a1a3f177bc52e9c1ae216799ab043d0df9ee08f80195bca6745c07
BLAKE2b-256 checksum
How to use checksums
dc65fac3174a29b7fc828be2a8f43ffc89e38c9d57e58ce3fb6c228838d253ef
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 17, 2026.

Transparency log

Security for divelet-ml 0.5.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.5.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 17, 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