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. Compatibility assessment is underway. 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.
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 and LinearRegression, 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 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
Initial Development Plan
The first phase focuses on three representative sections of the book:
| Section | Focus | Status |
|---|---|---|
2.1 chapter_preliminaries/ndarray.md |
Array operations and tensor fundamentals | Adapted |
3.3 chapter_linear-regression/synthetic-regression-data.md |
Synthetic datasets and numerical computation | Adapted |
11.3 chapter_attention-mechanisms-and-transformers/attention-scoring-functions.md |
Attention mechanisms and scoring functions | Adapted |
The PyTorch implementations serve as the primary reference.
Each adaptation will be reviewed for educational fidelity, browser compatibility, dependencies, and reproducibility.
The project will progressively expand to additional chapters based on the results of these initial experiments.
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.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| divelet_ml-0.3.0.tar.gz | 29.0 kB | With provenance | Details for divelet_ml-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| divelet_ml-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for divelet_ml-0.3.0-py3-none-any.whl |
Total release size: 53.1 kB
Release files / divelet_ml-0.3.0.tar.gz
| Download URL | divelet_ml-0.3.0.tar.gz |
|---|---|
| Size | 29.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8dbbacdfe0c51cfe2254a75c0d01bcd5108752c3967b8fedbde37245b315dcf6
|
|
BLAKE2b-256 checksum How to use checksums |
01f2608ec028f786bb40991750f8d9f38d5c1199238ac070a48abd844a958fa0
|
| 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 logRelease files / divelet_ml-0.3.0-py3-none-any.whl
| Download URL | divelet_ml-0.3.0-py3-none-any.whl |
|---|---|
| Size | 24.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b5aa176be9e1c42ac582cd1a53d1378dc3e5f4e09f3f6eb1b5f56f22b2153179
|
|
BLAKE2b-256 checksum How to use checksums |
179ffeb9b0c6a919da39a9612c6b9a17c4b0a05539bb0a8d5c78d5439dde596c
|
| 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 logSecurity for divelet-ml 0.3.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.
Attestation for divelet_ml-0.3.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 logA 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.