divelet-ml 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
divelet_ml/__init__.py
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"""divelet-ml's NumPy counterpart of the `d2l` library, imported as `import divelet_ml as d2l`.
|
|
2
|
+
|
|
3
|
+
`add_to_class`, `HyperParameters` and `DataModule` are adapted from `d2l/torch.py` in Dive into Deep Learning
|
|
4
|
+
(https://github.com/d2l-ai/d2l-en, commit 23d7a5aecceee57d1292c56e90cce307f183bb0a),
|
|
5
|
+
Copyright 2019 Amazon.com, Inc. or its affiliates, MIT-0 license (LICENSE-SAMPLECODE).
|
|
6
|
+
Only what adapted chapters use is here.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
__version__ = "0.1.0"
|
|
10
|
+
|
|
11
|
+
import inspect
|
|
12
|
+
|
|
13
|
+
import numpy as np
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def add_to_class(Class):
|
|
17
|
+
"""Register functions as methods in created class."""
|
|
18
|
+
def wrapper(obj):
|
|
19
|
+
setattr(Class, obj.__name__, obj)
|
|
20
|
+
return wrapper
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class HyperParameters:
|
|
24
|
+
"""The base class of hyperparameters."""
|
|
25
|
+
def save_hyperparameters(self, ignore=[]):
|
|
26
|
+
"""Save function arguments into class attributes."""
|
|
27
|
+
frame = inspect.currentframe().f_back
|
|
28
|
+
_, _, _, local_vars = inspect.getargvalues(frame)
|
|
29
|
+
self.hparams = {k: v for k, v in local_vars.items()
|
|
30
|
+
if k not in set(ignore + ['self']) and not k.startswith('_')}
|
|
31
|
+
for k, v in self.hparams.items():
|
|
32
|
+
setattr(self, k, v)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class DataModule(HyperParameters):
|
|
36
|
+
"""The base class of data."""
|
|
37
|
+
def __init__(self, root='../data', num_workers=4):
|
|
38
|
+
self.save_hyperparameters()
|
|
39
|
+
|
|
40
|
+
def get_dataloader(self, train):
|
|
41
|
+
raise NotImplementedError
|
|
42
|
+
|
|
43
|
+
def train_dataloader(self):
|
|
44
|
+
return self.get_dataloader(train=True)
|
|
45
|
+
|
|
46
|
+
def val_dataloader(self):
|
|
47
|
+
return self.get_dataloader(train=False)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class ArrayLoader:
|
|
51
|
+
"""Minibatches of NumPy arrays, in place of a framework's data loader such as PyTorch's `DataLoader`.
|
|
52
|
+
|
|
53
|
+
Iterating yields tuples of `batch_size` rows of each array. The last batch is smaller when
|
|
54
|
+
`batch_size` doesn't divide the number of rows, or left out with `drop_last=True`.
|
|
55
|
+
With `shuffle=True`, the rows are in a new random order on every pass.
|
|
56
|
+
"""
|
|
57
|
+
def __init__(self, arrays, batch_size, shuffle=False, drop_last=False):
|
|
58
|
+
assert len({len(a) for a in arrays}) == 1, 'arrays must have the same number of rows'
|
|
59
|
+
self.arrays, self.batch_size, self.shuffle, self.drop_last = arrays, batch_size, shuffle, drop_last
|
|
60
|
+
|
|
61
|
+
def __len__(self):
|
|
62
|
+
n = len(self.arrays[0])
|
|
63
|
+
return n // self.batch_size if self.drop_last else -(-n // self.batch_size)
|
|
64
|
+
|
|
65
|
+
def __iter__(self):
|
|
66
|
+
n = len(self.arrays[0])
|
|
67
|
+
order = np.random.permutation(n) if self.shuffle else np.arange(n)
|
|
68
|
+
for i in range(0, len(self) * self.batch_size, self.batch_size):
|
|
69
|
+
batch = order[i:i + self.batch_size]
|
|
70
|
+
yield tuple(a[batch] for a in self.arrays)
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: divelet-ml
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Dive into Deep Learning, adapted for JupyterLite
|
|
5
|
+
Project-URL: Homepage, https://github.com/decitre/divelet-ml
|
|
6
|
+
Project-URL: Documentation, https://decitre.github.io/divelet-ml/
|
|
7
|
+
Project-URL: Issues, https://github.com/decitre/divelet-ml/issues
|
|
8
|
+
Author: decitre
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
License-File: NOTICE.md
|
|
12
|
+
Requires-Python: >=3.11
|
|
13
|
+
Requires-Dist: numpy
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
|
|
16
|
+
<img src="https://raw.githubusercontent.com/decitre/divelet-ml/main/divelet-ml.svg"
|
|
17
|
+
alt="Divelet ML — Deep learning, in your browser"
|
|
18
|
+
width="600">
|
|
19
|
+
|
|
20
|
+
[![Build site][ci-badge]][ci-url]
|
|
21
|
+
[![Coverage][codecov-badge]][codecov-url]
|
|
22
|
+
[![Try xeus-python][xeus-badge]][xeus-tree]
|
|
23
|
+
[![Try Pyodide][pyodide-badge]][pyodide-tree]
|
|
24
|
+
[![Content: CC BY-SA 4.0][license-badge]][license-url]
|
|
25
|
+
[![Code: Apache 2.0][apache-badge]][apache]
|
|
26
|
+
|
|
27
|
+
# divelet-ml
|
|
28
|
+
|
|
29
|
+
**divelet for ML: Dive into Deep Learning, adapted for JupyterLite.**
|
|
30
|
+
|
|
31
|
+
divelet-ml is an experimental, browser-native adaptation of the Jupyter notebooks that accompany the book [*Dive into Deep Learning*][d2l-site] ("the book" below), designed to make its educational content and interactive examples accessible through [JupyterLite][jupyterlite] without requiring a local Python installation or a remote computation server.
|
|
32
|
+
|
|
33
|
+
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.
|
|
34
|
+
|
|
35
|
+
**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.
|
|
36
|
+
|
|
37
|
+
| Section | Original |
|
|
38
|
+
|---|---|
|
|
39
|
+
| 1 Introduction (no code) | [d2l.ai][d2l-1] |
|
|
40
|
+
| [2.1 Data Manipulation][xeus-2.1] [\[p\]][pyodide-2.1] | [d2l.ai][d2l-2.1] |
|
|
41
|
+
| [3.3 Synthetic Regression Data][xeus-3.3] [\[p\]][pyodide-3.3] | [d2l.ai][d2l-3.3] |
|
|
42
|
+
|
|
43
|
+
The notebooks' sources are in [`content/`][content].
|
|
44
|
+
|
|
45
|
+
Build the site locally with `./build.sh` (needs uv and micromamba).
|
|
46
|
+
|
|
47
|
+
## Python package
|
|
48
|
+
|
|
49
|
+
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:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install divelet-ml
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
import divelet_ml as d2l
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
It provides `add_to_class`, `HyperParameters` and `DataModule`, adapted from the book's `d2l/torch.py`, and `ArrayLoader`, which yields minibatches of NumPy arrays in place of PyTorch's `DataLoader`. 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.
|
|
60
|
+
|
|
61
|
+
## Motivation
|
|
62
|
+
|
|
63
|
+
Dive into Deep Learning is an open-source, interactive textbook combining mathematical explanations with executable code.
|
|
64
|
+
|
|
65
|
+
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.
|
|
66
|
+
|
|
67
|
+
divelet-ml explores whether the same educational progression can be maintained using lightweight, browser-compatible implementations.
|
|
68
|
+
|
|
69
|
+
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.
|
|
70
|
+
|
|
71
|
+
## Design Principles
|
|
72
|
+
|
|
73
|
+
- **Educational fidelity:** Preserve the book's explanations, mathematical formulations, learning objectives, and exercises wherever possible.
|
|
74
|
+
- **Browser-native execution:** Run examples entirely in the browser without requiring a remote Python kernel.
|
|
75
|
+
- **NumPy first:** Prefer NumPy implementations when they adequately illustrate the underlying concepts.
|
|
76
|
+
- **Framework independence:** Avoid unnecessary dependencies on full deep learning frameworks.
|
|
77
|
+
- **Progressive adaptation:** Adapt chapters individually, prioritizing educational value and technical feasibility.
|
|
78
|
+
- **Reproducibility:** Document runtime requirements, implementation differences, and compatibility limitations.
|
|
79
|
+
|
|
80
|
+
## Technical Approach
|
|
81
|
+
|
|
82
|
+
### JupyterLite
|
|
83
|
+
|
|
84
|
+
divelet-ml targets JupyterLite with two Python execution environments:
|
|
85
|
+
|
|
86
|
+
- **Pyodide:** Python compiled to WebAssembly, with access to a browser-compatible scientific Python ecosystem.
|
|
87
|
+
- **xeus-python:** A browser-native Python kernel built using WebAssembly.
|
|
88
|
+
|
|
89
|
+
Compatibility will be evaluated independently for each environment.
|
|
90
|
+
|
|
91
|
+
### NumPy and Deep Learning
|
|
92
|
+
|
|
93
|
+
Where practical, framework-specific operations will be replaced with NumPy equivalents.
|
|
94
|
+
|
|
95
|
+
This includes tensor manipulation, linear algebra, probability, optimization, and selected neural network implementations.
|
|
96
|
+
|
|
97
|
+
Some chapters may require more substantial adaptation, particularly those involving automatic differentiation, GPU acceleration, large datasets, or computationally expensive training.
|
|
98
|
+
|
|
99
|
+
The goal is to preserve the concepts being taught rather than provide identical framework APIs.
|
|
100
|
+
|
|
101
|
+
### Transformers.js and lmLite
|
|
102
|
+
|
|
103
|
+
For selected chapters involving modern language models or inference, divelet-ml may explore integration with [Transformers.js][transformers-js] through [lmLite][lmlite].
|
|
104
|
+
|
|
105
|
+
lmLite provides Python access to browser-native machine learning inference.
|
|
106
|
+
|
|
107
|
+
This integration is optional and is not intended to replace the mathematical and algorithmic foundations of the book.
|
|
108
|
+
|
|
109
|
+
## Compatibility Assessment
|
|
110
|
+
|
|
111
|
+
An initial static audit of the book's source repository has been developed to identify:
|
|
112
|
+
|
|
113
|
+
- Framework-specific implementations and dependencies.
|
|
114
|
+
- Candidate chapters for direct adaptation.
|
|
115
|
+
- Potential incompatibilities with browser-native Python runtimes.
|
|
116
|
+
- Estimated adaptation effort.
|
|
117
|
+
- Opportunities for alternative browser-native implementations.
|
|
118
|
+
|
|
119
|
+
The audit distinguishes static compatibility estimates from actual execution results.
|
|
120
|
+
|
|
121
|
+
**Static analysis does not establish that a chapter runs successfully in JupyterLite.** Browser execution and educational fidelity must be validated separately.
|
|
122
|
+
|
|
123
|
+
The initial audit references the book's commit:
|
|
124
|
+
|
|
125
|
+
`23d7a5aecceee57d1292c56e90cce307f183bb0a`
|
|
126
|
+
|
|
127
|
+
## Initial Development Plan
|
|
128
|
+
|
|
129
|
+
The first phase focuses on three representative sections of the book:
|
|
130
|
+
|
|
131
|
+
| Section | Focus | Status |
|
|
132
|
+
|---|---|---|
|
|
133
|
+
| 2.1 `chapter_preliminaries/ndarray.md` | Array operations and tensor fundamentals | Adapted |
|
|
134
|
+
| 3.3 `chapter_linear-regression/synthetic-regression-data.md` | Synthetic datasets and numerical computation | Adapted |
|
|
135
|
+
| 11.3 `chapter_attention-mechanisms-and-transformers/attention-scoring-functions.md` | Attention mechanisms and scoring functions | Planned |
|
|
136
|
+
|
|
137
|
+
The PyTorch implementations serve as the primary reference.
|
|
138
|
+
|
|
139
|
+
Each adaptation will be reviewed for educational fidelity, browser compatibility, dependencies, and reproducibility.
|
|
140
|
+
|
|
141
|
+
The project will progressively expand to additional chapters based on the results of these initial experiments.
|
|
142
|
+
|
|
143
|
+
See [ROADMAP.md][roadmap] for further details.
|
|
144
|
+
|
|
145
|
+
## Relationship to Dive into Deep Learning
|
|
146
|
+
|
|
147
|
+
divelet-ml is an independent adaptation of the original [Dive into Deep Learning][d2l-repo] project.
|
|
148
|
+
|
|
149
|
+
It is not an official edition of the book and is not affiliated with or endorsed by the original authors.
|
|
150
|
+
|
|
151
|
+
The project intends to preserve the educational contributions of the book while adapting selected implementations for browser-native execution.
|
|
152
|
+
|
|
153
|
+
Adapted chapters will identify their original sources and document substantive modifications.
|
|
154
|
+
|
|
155
|
+
## License and Attribution
|
|
156
|
+
|
|
157
|
+
The original Dive into Deep Learning book content is distributed under the [Creative Commons Attribution-ShareAlike 4.0 International License][cc-by-sa].
|
|
158
|
+
|
|
159
|
+
Adapted educational content derived from the book will retain the applicable attribution and ShareAlike requirements.
|
|
160
|
+
|
|
161
|
+
divelet-ml's own source code (the `divelet_ml` package, build scripts and tests) is licensed under the [Apache License 2.0][apache]. Third-party materials may be subject to separate licenses; these will be reviewed and their required notices preserved before redistribution.
|
|
162
|
+
|
|
163
|
+
See [CONTENT-LICENSE.md][license-url] and [NOTICE.md][notice] for licensing and attribution details.
|
|
164
|
+
|
|
165
|
+
## Feedback and Contributions
|
|
166
|
+
|
|
167
|
+
divelet-ml is an experimental project exploring browser-native deep learning education.
|
|
168
|
+
|
|
169
|
+
Feedback is particularly welcome on:
|
|
170
|
+
|
|
171
|
+
- The educational usefulness of framework-independent implementations.
|
|
172
|
+
- The fidelity of NumPy adaptations to the book's original examples.
|
|
173
|
+
- JupyterLite compatibility, performance, and runtime limitations.
|
|
174
|
+
- Opportunities for browser-native machine learning beyond traditional Python frameworks.
|
|
175
|
+
|
|
176
|
+
Please share suggestions, bug reports, and use cases through [GitHub Issues][issues]. To set up a development environment, run the tests or make a release, see [CONTRIBUTING.md][contributing].
|
|
177
|
+
|
|
178
|
+
[ci-badge]: https://github.com/decitre/divelet-ml/actions/workflows/build.yml/badge.svg
|
|
179
|
+
[ci-url]: https://github.com/decitre/divelet-ml/actions/workflows/build.yml
|
|
180
|
+
[codecov-badge]: https://img.shields.io/codecov/c/github/decitre/divelet-ml/main?flag=python&label=Coverage&logo=codecov
|
|
181
|
+
[codecov-url]: https://codecov.io/gh/decitre/divelet-ml
|
|
182
|
+
[xeus-tree]: https://decitre.github.io/divelet-ml/xeus/tree/
|
|
183
|
+
[pyodide-tree]: https://decitre.github.io/divelet-ml/pyodide/tree/
|
|
184
|
+
[xeus-badge]: https://img.shields.io/badge/try-xeus--python-f7dc1e.svg?logo=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Q1LS4wMzgtLjE2MS0uMDgyLS4xNjEtLjI2NHoiIGFyaWEtbGFiZWw9ImoiIHN0eWxlPSJmaWxsOiMxYTFhMWE7c3Ryb2tlLXdpZHRoOi4yNjQ1ODMzNSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTc2LjQwOSAtNzkuNDczKSIvPjwvZz48L2c+PC9nPjwvc3ZnPiA=
|
|
186
|
+
[license-badge]: https://img.shields.io/badge/Content-CC%20BY--SA%204.0-lightgrey.svg
|
|
187
|
+
[apache-badge]: https://img.shields.io/badge/Code-Apache%202.0-blue.svg
|
|
188
|
+
[license-url]: https://github.com/decitre/divelet-ml/blob/main/CONTENT-LICENSE.md
|
|
189
|
+
[d2l-site]: https://d2l.ai/
|
|
190
|
+
[jupyterlite]: https://jupyterlite.readthedocs.io/
|
|
191
|
+
[d2l-1]: https://d2l.ai/chapter_introduction/index.html
|
|
192
|
+
[content]: https://github.com/decitre/divelet-ml/tree/main/content
|
|
193
|
+
[xeus-2.1]: https://decitre.github.io/divelet-ml/xeus/notebooks/index.html?path=02_preliminaries/02.01_ndarray.ipynb
|
|
194
|
+
[pyodide-2.1]: https://decitre.github.io/divelet-ml/pyodide/notebooks/index.html?path=02_preliminaries/02.01_ndarray.ipynb
|
|
195
|
+
[d2l-2.1]: https://d2l.ai/chapter_preliminaries/ndarray.html
|
|
196
|
+
[xeus-3.3]: https://decitre.github.io/divelet-ml/xeus/notebooks/index.html?path=03_linear-regression/03.03_synthetic-regression-data.ipynb
|
|
197
|
+
[pyodide-3.3]: https://decitre.github.io/divelet-ml/pyodide/notebooks/index.html?path=03_linear-regression/03.03_synthetic-regression-data.ipynb
|
|
198
|
+
[d2l-3.3]: https://d2l.ai/chapter_linear-regression/synthetic-regression-data.html
|
|
199
|
+
[transformers-js]: https://huggingface.co/docs/transformers.js/
|
|
200
|
+
[lmlite]: https://github.com/decitre/lmlite
|
|
201
|
+
[roadmap]: https://github.com/decitre/divelet-ml/blob/main/ROADMAP.md
|
|
202
|
+
[d2l-repo]: https://github.com/d2l-ai/d2l-en
|
|
203
|
+
[cc-by-sa]: https://creativecommons.org/licenses/by-sa/4.0/
|
|
204
|
+
[notice]: https://github.com/decitre/divelet-ml/blob/main/NOTICE.md
|
|
205
|
+
[issues]: https://github.com/decitre/divelet-ml/issues
|
|
206
|
+
[contributing]: https://github.com/decitre/divelet-ml/blob/main/CONTRIBUTING.md
|
|
207
|
+
[apache]: https://github.com/decitre/divelet-ml/blob/main/LICENSE
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
divelet_ml/__init__.py,sha256=p0A_HA5uoEa69WUA88bbiYEPIoIT5pyYZ4t1pZ-qQ9s,2665
|
|
2
|
+
divelet_ml-0.1.0.dist-info/METADATA,sha256=YKpjqTjJ7g_0cEK6M13JLW21Bmd7bZP3aFIrTPulCVA,15516
|
|
3
|
+
divelet_ml-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
4
|
+
divelet_ml-0.1.0.dist-info/licenses/LICENSE,sha256=yVuuHRzgI17MzTVgt3LsHvuX80innw--CmNPDCzO_iw,11358
|
|
5
|
+
divelet_ml-0.1.0.dist-info/licenses/NOTICE.md,sha256=Rmb7uIOxSn0loJzvKEH8htwOqLK6koTVHvqJ-YeaAC4,3468
|
|
6
|
+
divelet_ml-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
202
|
+
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Attribution and Modification Notices
|
|
2
|
+
|
|
3
|
+
divelet-ml
|
|
4
|
+
Copyright 2026 Emmanuel Decitre
|
|
5
|
+
|
|
6
|
+
## Original Work
|
|
7
|
+
|
|
8
|
+
**Dive into Deep Learning** is an open-source interactive textbook developed by its original authors and contributors.
|
|
9
|
+
|
|
10
|
+
- **Website:** https://d2l.ai/
|
|
11
|
+
- **Source repository:** https://github.com/d2l-ai/d2l-en
|
|
12
|
+
- **Authors and contributors:** As credited in the original project
|
|
13
|
+
- **Book content license:** Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
|
|
14
|
+
- **License:** https://creativecommons.org/licenses/by-sa/4.0/
|
|
15
|
+
|
|
16
|
+
The initial divelet-ml compatibility assessment used the following upstream revision:
|
|
17
|
+
|
|
18
|
+
`23d7a5aecceee57d1292c56e90cce307f183bb0a`
|
|
19
|
+
|
|
20
|
+
https://github.com/d2l-ai/d2l-en/commit/23d7a5aecceee57d1292c56e90cce307f183bb0a
|
|
21
|
+
|
|
22
|
+
## Nature of the Adaptation
|
|
23
|
+
|
|
24
|
+
**divelet-ml** is an independent, browser-native adaptation of Dive into Deep Learning for JupyterLite.
|
|
25
|
+
|
|
26
|
+
The project aims to preserve the original book's educational structure, mathematical explanations, learning objectives, and exercises while adapting framework-dependent implementations for execution in browser-native Python environments.
|
|
27
|
+
|
|
28
|
+
Modifications, which vary between chapters, include:
|
|
29
|
+
|
|
30
|
+
- Replacing selected framework-specific implementations with NumPy or other browser-compatible alternatives.
|
|
31
|
+
- Adapting code examples for JupyterLite using Pyodide and xeus-python.
|
|
32
|
+
- Modifying dependency installation, dataset loading, and execution instructions where necessary.
|
|
33
|
+
- Introducing alternative browser-native implementations for selected machine learning tasks.
|
|
34
|
+
- Documenting differences in functionality, performance, and compatibility.
|
|
35
|
+
|
|
36
|
+
The adapted sections are listed in the README and published at https://decitre.github.io/divelet-ml/. Each one's notebook lists the specific changes made to it.
|
|
37
|
+
|
|
38
|
+
## Attribution of Adapted Chapters
|
|
39
|
+
|
|
40
|
+
The notebook of each adapted section opens with a one-line credit and ends with an "Attribution and changes" section that provides:
|
|
41
|
+
|
|
42
|
+
1. A reference to the corresponding chapter of the original book.
|
|
43
|
+
2. Identification of the upstream source revision.
|
|
44
|
+
3. Attribution to the original authors and contributors.
|
|
45
|
+
4. A description of substantive modifications.
|
|
46
|
+
5. Applicable license information.
|
|
47
|
+
|
|
48
|
+
Adapted educational content derived from the book is distributed under the terms of CC BY-SA 4.0.
|
|
49
|
+
|
|
50
|
+
## Source Code and Third-Party Materials
|
|
51
|
+
|
|
52
|
+
The licensing of executable code, illustrations, datasets, and other third-party materials may differ from that of the book's educational content.
|
|
53
|
+
|
|
54
|
+
Before incorporating such materials, divelet-ml will review their applicable licenses and preserve required copyright notices, attribution, and license terms.
|
|
55
|
+
|
|
56
|
+
The CC BY-SA 4.0 designation for adapted book content does not automatically apply to independently developed software or separately licensed third-party materials.
|
|
57
|
+
|
|
58
|
+
Code adapted from the book's sample code is used under its MIT-0 license. divelet-ml's own source code (the `divelet_ml` package, build scripts and tests) is licensed under the Apache License 2.0; see `LICENSE`.
|
|
59
|
+
|
|
60
|
+
## Independence
|
|
61
|
+
|
|
62
|
+
divelet-ml is not an official edition of Dive into Deep Learning.
|
|
63
|
+
|
|
64
|
+
It is not affiliated with, sponsored by, or endorsed by the book's original authors or maintainers.
|
|
65
|
+
|
|
66
|
+
divelet-ml is not affiliated with D2L Corporation or its products.
|
|
67
|
+
|
|
68
|
+
The original work and its associated rights remain with their respective authors and copyright holders.
|
|
69
|
+
|
|
70
|
+
## Project Repository
|
|
71
|
+
|
|
72
|
+
https://github.com/decitre/divelet-ml
|