lmur 2.2.8__tar.gz → 2.2.14__tar.gz
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.
- {lmur-2.2.8 → lmur-2.2.14}/LICENSE +1 -1
- {lmur-2.2.8 → lmur-2.2.14}/PKG-INFO +152 -49
- {lmur-2.2.8 → lmur-2.2.14}/README.md +146 -45
- {lmur-2.2.8 → lmur-2.2.14}/lmur.egg-info/PKG-INFO +152 -49
- lmur-2.2.14/lmur.egg-info/requires.txt +9 -0
- {lmur-2.2.8 → lmur-2.2.14}/pyproject.toml +8 -5
- lmur-2.2.14/requirements.txt +1 -0
- lmur-2.2.14/version +1 -0
- lmur-2.2.8/lmur.egg-info/requires.txt +0 -4
- lmur-2.2.8/requirements.txt +0 -1
- lmur-2.2.8/version +0 -1
- {lmur-2.2.8 → lmur-2.2.14}/lmur.egg-info/SOURCES.txt +0 -0
- {lmur-2.2.8 → lmur-2.2.14}/lmur.egg-info/dependency_links.txt +0 -0
- {lmur-2.2.8 → lmur-2.2.14}/lmur.egg-info/top_level.txt +0 -0
- {lmur-2.2.8 → lmur-2.2.14}/setup.cfg +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lmur
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.14
|
|
4
4
|
Summary: Neural Network Dataset
|
|
5
5
|
Author-email: ABrain One and contributors <AI@ABrain.one>
|
|
6
6
|
License: MIT License
|
|
7
7
|
|
|
8
|
-
Copyright (c) 2024- ABrain
|
|
8
|
+
Copyright (c) 2024- ABrain-One and contributors
|
|
9
9
|
All rights reserved.
|
|
10
10
|
|
|
11
11
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
@@ -40,9 +40,11 @@ Classifier: Intended Audience :: Science/Research
|
|
|
40
40
|
Requires-Python: >=3.10
|
|
41
41
|
Description-Content-Type: text/markdown
|
|
42
42
|
License-File: LICENSE
|
|
43
|
-
Requires-Dist: nn-dataset==2.2.
|
|
43
|
+
Requires-Dist: nn-dataset==2.2.14
|
|
44
44
|
Provides-Extra: stat
|
|
45
|
-
|
|
45
|
+
Provides-Extra: tflite
|
|
46
|
+
Provides-Extra: tflite-run
|
|
47
|
+
Provides-Extra: litert
|
|
46
48
|
Dynamic: license-file
|
|
47
49
|
|
|
48
50
|
## <img src='https://abrain.one/img/lemur-nn-icon-64x64.png' width='32px'/> Neural Network Dataset
|
|
@@ -53,36 +55,51 @@ LEMUR - Learning, Evaluation, and Modeling for Unified Research
|
|
|
53
55
|
|
|
54
56
|
<img src='https://abrain.one/img/lemur-nn-whit.jpg' width='25%'/>
|
|
55
57
|
|
|
56
|
-
The original version of the <a href='https://github.com/ABrain-One/
|
|
58
|
+
The original open-source version of the <a href='https://github.com/ABrain-One/NN-Dataset'>LEMUR dataset</a> was developed by <strong>Arash Torabi Goodarzi, Roman Kochnev</strong> and <strong>Zofia Antonina Bentyn</strong> at the Computer Vision Laboratory, University of Würzburg, Germany, under the supervision and technical guidance of <strong>Dr. Dmitry Ignatov</strong>, whose foundational work established the basis for the project.
|
|
57
59
|
|
|
58
60
|
## Contents
|
|
59
61
|
|
|
60
62
|
1. [📖 Overview](#-overview)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
- [Statement of Need](#statement-of-need)
|
|
64
|
+
- [Available Modules](#available-modules)
|
|
65
|
+
2. [Create and Activate a Virtual Environment](#create-and-activate-a-virtual-environment-recommended)
|
|
66
|
+
3. [Environment for NN Dataset Contributors](#environment-for-nn-dataset-contributors)
|
|
65
67
|
- [Pip Package Manager](#pip-package-manager)
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
4. [Contribution: Adding a New Neural Network Model](#contribution)
|
|
69
|
+
5. [Installation or Update of the NN Dataset with pip](#installation-or-update-of-the-nn-dataset-with-pip)
|
|
70
|
+
- [Requirements, Network Access and Disk Space](#requirements-network-access-and-disk-space)
|
|
71
|
+
- [Optional Export Extras (TFLite / LiteRT)](#optional-export-extras-tflite--litert)
|
|
72
|
+
6. [Usage](#usage)
|
|
70
73
|
- [Standard Use Cases](#standard-use-cases)
|
|
71
74
|
- [Reproducing Results with Fixed Training Parameters](#reproducing-results-with-fixed-training-parameters)
|
|
72
75
|
- [View Supported Flags](#to-view-supported-flags)
|
|
73
|
-
|
|
76
|
+
7. [💻 API: Programmatic Access](#-api-programmatic-access)
|
|
74
77
|
- [Why the API is Important](#why-the-api-is-important)
|
|
75
78
|
- [Data Extraction and Mechanism](#data-extraction-and-mechanism)
|
|
76
79
|
- [The `data()` Function for Data Retrieval](#1-the-data-function-for-data-retrieval)
|
|
77
80
|
- [The `check_nn()` Function for NN Validation](#2-the-check_nn-function-for-nn-validation)
|
|
81
|
+
- [Example: Query and Validate](#example-query-and-validate)
|
|
78
82
|
- [🚀 Get Started: Build Smarter, Train Less](#-get-started-build-smarter-train-less)
|
|
79
|
-
|
|
80
|
-
- [Example of Training LEMUR Neural Network within AI Linux Container](#example-of-training-lemur-neural-network-within-ai-linux-container-linux-host)
|
|
83
|
+
8. [🐳 Docker](#-docker)
|
|
84
|
+
- [Example of Training LEMUR Neural Network within the AI Linux Container](#example-of-training-lemur-neural-network-within-the-ai-linux-container-linux-host)
|
|
85
|
+
9. [Support and Contributing](#support-and-contributing)
|
|
81
86
|
10. [Citation](#citation)
|
|
82
87
|
11. [Licenses](#licenses)
|
|
83
88
|
|
|
84
|
-
|
|
85
|
-
|
|
89
|
+
### 📖 Overview
|
|
90
|
+
|
|
91
|
+
NN Dataset project provides flexibility for dynamically combining various deep learning tasks, datasets, metrics, and neural network models. It is designed to facilitate the verification of neural network performance under various combinations of training hyperparameters and data transformation algorithms, by automatically generating performance statistics. Developed to support the <a href='https://github.com/ABrain-One/nn-gpt'>NNGPT</a> project, this dataset contains neural network models modified or generated by NNGPT's large language models, with names featuring alphanumeric postfixes (e.g., C10C-ResNetTransformer-e2b49b871c8b9a9014277a51b2348999).
|
|
92
|
+
|
|
93
|
+
### Statement of Need
|
|
94
|
+
|
|
95
|
+
Studies of neural network architectures and training procedures repeatedly need the same components: training code, a way to store results together with the model code and settings that produced them, and consistent measurements of accuracy, running time and resource use. LEMUR provides these in one package: a common model interface (each model, data loader, transformation and metric is a single Python file), a shared training pipeline built on PyTorch and Optuna, and a database that stores every epoch's result with its hyperparameters, transformation and hardware context. The records are queryable from Python through the [API](#-api-programmatic-access).
|
|
96
|
+
|
|
97
|
+
LEMUR is intended for:
|
|
98
|
+
- researchers running comparative studies across many architectures, who need a uniform training and evaluation procedure;
|
|
99
|
+
- AutoML and code-generation systems, such as <a href='https://github.com/ABrain-One/nn-gpt'>NNGPT</a>, that need candidate networks validated programmatically within a search loop;
|
|
100
|
+
- researchers and students who want to reuse existing measurements instead of recomputing them.
|
|
101
|
+
|
|
102
|
+
Model libraries such as `timm` provide implementations and weights, benchmarks such as NAS-Bench-101/201 provide results for fixed collections of architectures, and experiment trackers such as MLflow or Weights & Biases record runs that users train with their own code. LEMUR combines model code, a shared training and evaluation protocol, and linked, queryable records, and accepts new models as source code. See the [JOSS paper](paper/paper.md) for details.
|
|
86
103
|
|
|
87
104
|
### Available Modules
|
|
88
105
|
|
|
@@ -96,17 +113,18 @@ The `NN Dataset` includes the following key modules within the **<a href='https:
|
|
|
96
113
|
|
|
97
114
|
## Create and Activate a Virtual Environment (recommended)
|
|
98
115
|
For Linux/Mac:
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
116
|
+
```bash
|
|
117
|
+
python3 -m venv .venv
|
|
118
|
+
source .venv/bin/activate
|
|
119
|
+
python -m pip install --upgrade pip
|
|
120
|
+
```
|
|
121
|
+
|
|
104
122
|
For Windows:
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
123
|
+
```bash
|
|
124
|
+
python3 -m venv .venv
|
|
125
|
+
.venv\Scripts\activate
|
|
126
|
+
python -m pip install --upgrade pip
|
|
127
|
+
```
|
|
110
128
|
|
|
111
129
|
It is assumed that CUDA 13.0 is installed; otherwise, consider replacing 'cu130' with the appropriate version. Some neural network training tasks require GPUs with at least 24 GB of memory.
|
|
112
130
|
|
|
@@ -132,12 +150,12 @@ To contribute a new neural network (NN) model to the NN Dataset, please ensure t
|
|
|
132
150
|
4. All external information required for the correct building and training of the NN model for a specific dataset/transformer, as well as the list of hyperparameters, is extracted from <strong>in_shape</strong>, <strong>out_shape</strong> or <strong>prm</strong>, e.g.: </br>`batch = in_shape[0]` </br>`channel_number = in_shape[1]` </br>`image_size = in_shape[2]` </br>`class_number = out_shape[0]` </br>`learning_rate = prm['lr']` </br>`momentum = prm['momentum']` </br>`dropout = prm['dropout']`.
|
|
133
151
|
5. Every model script has function returning set of supported hyperparameters, e.g.: </br>`def supported_hyperparameters(): return {'lr', 'momentum', 'dropout'}`</br> The value of each hyperparameter lies within the range of 0.0 to 1.0.
|
|
134
152
|
6. Every class <strong>Net</strong> implements two functions: </br>`train_setup(self, prm)`</br> and </br>`learn(self, train_data)`</br> The first function initializes the `criteria` and `optimizer`, while the second implements the training pipeline. See a simple implementation in the <a href="https://github.com/ABrain-One/nn-dataset/blob/main/ab/nn/nn/AlexNet.py">AlexNet model</a>.
|
|
135
|
-
7. For each pull request involving a new NN model, please generate and submit training statistics for 10 Optuna trials (or at least 3 trials for very large models) in the <strong>ab/nn/stat</strong> directory. The trials should cover 5 epochs of training. Ensure that this statistics is included along with the model in your pull request. For example, the statistics for the ComplexNet model are stored in files <strong><epoch number>.json</strong> inside folder <strong>img-classification_cifar-10_acc_ComplexNet</strong>, and can be generated by:<br/>
|
|
153
|
+
7. For each pull request involving a new NN model, please generate and submit training statistics for 10 Optuna trials (or at least 3 trials for very large models) in the <strong>ab/nn/stat/train</strong> directory. The trials should cover 5 epochs of training. Ensure that this statistics is included along with the model in your pull request. For example, the statistics for the ComplexNet model are stored in files <strong><epoch number>.json</strong> inside folder <strong>ab/nn/stat/train/img-classification_cifar-10_acc_ComplexNet</strong>, and can be generated by:<br/>
|
|
136
154
|
```bash
|
|
137
|
-
python -m ab.nn.train -c img-classification_cifar-10_acc_ComplexNet -f complex -t
|
|
155
|
+
python -m ab.nn.train -c img-classification_cifar-10_acc_ComplexNet -f complex -t 10 -e 5
|
|
138
156
|
```
|
|
139
157
|
|
|
140
|
-
Before creating a pull request, run
|
|
158
|
+
Before creating a pull request, run the test suite as described in <a href="CONTRIBUTING.md#running-the-tests">CONTRIBUTING.md</a> to ensure that your changes do not break the core functionality of the NN Dataset.
|
|
141
159
|
|
|
142
160
|
<p>See more examples of models in <code>/ab/nn/nn</code> and generated statistics in <code>/ab/nn/stat</code>.</p>
|
|
143
161
|
|
|
@@ -167,24 +185,75 @@ Adding functionality to export data to Excel files and generate plots for <a hre
|
|
|
167
185
|
```bash
|
|
168
186
|
pip install nn-dataset[stat] --upgrade --extra-index-url https://download.pytorch.org/whl/cu130
|
|
169
187
|
```
|
|
170
|
-
and export/generate:
|
|
188
|
+
and export/generate (the `ab.stat` module is provided by the <a href='https://github.com/ABrain-One/nn-stat'>nn-stat</a> package installed by this extra):
|
|
171
189
|
```bash
|
|
172
190
|
python -m ab.stat.export
|
|
173
191
|
```
|
|
174
192
|
|
|
193
|
+
### Requirements, Network Access and Disk Space
|
|
194
|
+
|
|
195
|
+
- Python 3.10 or newer is required (the CI tests 3.10 and 3.11). All runtime dependencies are listed in <a href='requirements.txt'>requirements.txt</a> and are installed automatically by pip. The `--extra-index-url` only selects the CUDA 13.0 build of PyTorch; on other systems, replace `cu130` with your CUDA version or use `https://download.pytorch.org/whl/cpu`.
|
|
196
|
+
- Training uses an NVIDIA GPU when one is available and otherwise falls back to Apple MPS or the CPU, so small models and the API run on any machine; large studies are practical only on a GPU.
|
|
197
|
+
- **The first import downloads data.** Importing `ab.nn.api` or running `ab.nn.train` opens the LEMUR database `db/ab.nn.db` in the current working directory (in a cloned repository, its root). If the file does not exist, it is built from the statistics in `ab/nn/stat` when that folder is present (a full clone; this takes a while), and otherwise downloaded from the <a href='https://huggingface.co/NN-Dataset/LEMUR_DB'>LEMUR_DB</a> Hugging Face repository as `ab.nn.zst-<version>` (about 225 MB for version 2.2.11) and decompressed to `db/ab.nn.db`, which is larger than the download (the compressed file is removed afterwards).
|
|
198
|
+
- The database file is chosen by the installed package version. If the database of that version has not been published yet, e.g. for a development version installed from GitHub, the download fails with a 404 error; install the stable release from PyPI instead.
|
|
199
|
+
- Datasets are downloaded to `data/` when a pipeline first uses them (e.g. CIFAR-10), and training outputs are written to `out/`.
|
|
200
|
+
|
|
201
|
+
### Optional export extras (TFLite / LiteRT)
|
|
202
|
+
|
|
203
|
+
The TFLite export dependencies are **not** part of the default installation. Each
|
|
204
|
+
pins its own transitive versions, the two are mutually exclusive with each other,
|
|
205
|
+
and both conflict with environments that also contain vLLM. Install whichever one
|
|
206
|
+
you need into a **dedicated virtual environment**.
|
|
207
|
+
|
|
208
|
+
Running an existing `.tflite` model (inference only, no TensorFlow). This one is
|
|
209
|
+
light and installs cleanly next to the main requirements:
|
|
210
|
+
```bash
|
|
211
|
+
pip install nn-dataset[tflite-run]
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Converting ONNX → TFLite with `onnx2tf` (`util/py/age/convert_onnx_to_tflite_age.py`,
|
|
215
|
+
`demo/*`). Pulls full TensorFlow, so use a separate environment:
|
|
216
|
+
```bash
|
|
217
|
+
python -m venv .venv-tflite && . .venv-tflite/bin/activate
|
|
218
|
+
pip install nn-dataset[tflite]
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
PyTorch → TFLite through Google LiteRT (`litert-torch`), no Windows wheels:
|
|
222
|
+
```bash
|
|
223
|
+
python -m venv .venv-litert && . .venv-litert/bin/activate
|
|
224
|
+
pip install nn-dataset[litert]
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Why they are separate:
|
|
228
|
+
|
|
229
|
+
| Pin | Conflicts with |
|
|
230
|
+
|---|---|
|
|
231
|
+
| `onnx2tf` → `setuptools==81.0.0` | vLLM: `setuptools<81.0.0` |
|
|
232
|
+
| `onnx2tf` → `ai-edge-litert==2.1.2` | `litert-torch`: `ai-edge-litert>=2.3.0` |
|
|
233
|
+
| `onnx2tf` → `onnxruntime==1.26.0` | `onnxruntime-gpu` (same `onnxruntime` import namespace) |
|
|
234
|
+
| `litert-torch` → `xdsl==0.28.0` | `typing-extensions<4.13` vs vLLM → `pydantic>=2.12` needing `>=4.14.1` |
|
|
235
|
+
|
|
236
|
+
There is no lite-only converter: `tf.lite.TFLiteConverter` ships with full
|
|
237
|
+
TensorFlow, so `[tflite]` cannot be slimmed down. Only the inference side can,
|
|
238
|
+
which is what `[tflite-run]` is for.
|
|
239
|
+
|
|
240
|
+
Installing an extra alongside the main requirements in one environment will fail
|
|
241
|
+
to resolve. That is intentional — the alternative is a silently broken
|
|
242
|
+
environment.
|
|
243
|
+
|
|
175
244
|
## Usage
|
|
176
245
|
|
|
177
|
-
Standard
|
|
246
|
+
### Standard Use Cases
|
|
178
247
|
|
|
179
248
|
Run the automated training process for this model (e.g., a new ComplexNet training pipeline configuration):
|
|
180
249
|
```bash
|
|
181
|
-
python -m ab.nn.train -f complex -c img-classification_cifar-10_acc_ComplexNet -l 0.017 --min_learning_rate 0.013 -m 0.025 --min_momentum 0.022
|
|
250
|
+
python -m ab.nn.train -f complex -c img-classification_cifar-10_acc_ComplexNet -l 0.017 --min_learning_rate 0.013 -m 0.025 --min_momentum 0.022 --min_batch_binary_power 8 --max_batch_binary_power 9
|
|
182
251
|
```
|
|
183
252
|
or for all image segmentation models using a fixed range of training parameters and transformer:
|
|
184
253
|
```bash
|
|
185
254
|
. train.sh -c img-segmentation -f echo --min_learning_rate 1e-4 -l 1e-2 --min_momentum 0.8 -m 0.99 --min_batch_binary_power 2 -b 6
|
|
186
255
|
```
|
|
187
|
-
`train.sh` internally calls `ab.nn.train`, offering a shorter way to run the program. Both scripts accept the same input flags and can be used interchangeably.
|
|
256
|
+
`train.sh` internally calls `ab.nn.train`, offering a shorter way to run the program. Both scripts accept the same input flags and can be used interchangeably (on Windows, use `python -m ab.nn.train`).
|
|
188
257
|
|
|
189
258
|
##### Reproducing Results with Fixed Training Parameters
|
|
190
259
|
|
|
@@ -210,6 +279,8 @@ where:
|
|
|
210
279
|
. train.sh -h
|
|
211
280
|
```
|
|
212
281
|
|
|
282
|
+
To list the tasks, models and best accuracies stored in the database from a cloned repository, use `info.py` (see <a href='info_README.md'>info_README.md</a>).
|
|
283
|
+
|
|
213
284
|
**Add your new neural network model to the `ab/nn/nn` directory and proceed with your experiments (see [Contribution](#contribution) for details).**
|
|
214
285
|
|
|
215
286
|
|
|
@@ -222,7 +293,7 @@ The **LEMUR NN Dataset API** (`ab.nn.api`) is the dedicated programmatic interfa
|
|
|
222
293
|
The API solves the problem of **costly and time-consuming model validation**. By providing two distinct and powerful functions, it transforms the bottleneck of "waiting for results" into two key steps: instant query and automated validation.
|
|
223
294
|
|
|
224
295
|
1. **Enables Predictive Models:** Access to the full historical data allows researchers to train **performance prediction models** that can estimate a model's final accuracy *before* any training begins, saving massive amounts of compute time.
|
|
225
|
-
2. **Facilitates LLM Feedback:** The API acts as the crucial feedback mechanism for LLMs (like NNGPT). Generated architectures are validated via `check_nn`,
|
|
296
|
+
2. **Facilitates LLM Feedback:** The API acts as the crucial feedback mechanism for LLMs (like NNGPT). Generated architectures are validated via `check_nn`, their results are stored in the database and become available through `data()`, enabling the LLM to iteratively improve its quality based on its own outputs.
|
|
226
297
|
|
|
227
298
|
### Data Extraction and Mechanism
|
|
228
299
|
|
|
@@ -231,9 +302,11 @@ The core value of the API is the ability to retrieve complete, validated experim
|
|
|
231
302
|
#### 1. The `data()` Function for Data Retrieval
|
|
232
303
|
|
|
233
304
|
```python
|
|
234
|
-
def data(...) -> pandas.DataFrame
|
|
305
|
+
def data(only_best_accuracy=False, task=None, dataset=None, metric=None, nn=None, epoch=None, max_rows=None, ...) -> pandas.DataFrame
|
|
235
306
|
```
|
|
236
307
|
|
|
308
|
+
Each row also contains `'task'`, `'dataset'`, `'metric'`, `'metric_code'`, `'nn'`, `'epoch'` and `'transform_code'`. The main columns are:
|
|
309
|
+
|
|
237
310
|
| Data Type Extracted | DataFrame Column Name | Description |
|
|
238
311
|
| :--- | :--- | :--- |
|
|
239
312
|
| **Model Python Code** | `'nn_code'` | The **exact Python code (as a string)** defining the neural network's architecture. |
|
|
@@ -243,21 +316,41 @@ def data(...) -> pandas.DataFrame
|
|
|
243
316
|
|
|
244
317
|
**Mechanism:** Users filter the database using optional arguments (`task`, `dataset`, `nn`, etc.). The returned DataFrame allows external programs (such as statistical models or benchmark scripts) to easily consume the structured data for large-scale analysis. The optional `only_best_accuracy=True` ensures efficiency by returning only the best-performing trial for each unique configuration.
|
|
245
318
|
|
|
319
|
+
Further query functions in `ab.nn.api` return other record types as DataFrames: `run_data()` (on-device runtime and TFLite analytics), `prun_data()` (pruning results), `nn_stat_data()` (architecture statistics) and `layer_data()` (layer analysis). All arguments are described in the docstrings, e.g. `help(ab.nn.api.data)`.
|
|
320
|
+
|
|
246
321
|
#### 2. The `check_nn()` Function for NN Validation
|
|
247
322
|
|
|
248
323
|
```python
|
|
249
|
-
def check_nn(nn_code: str, task: str, dataset: str, metric: str, prm: dict,
|
|
324
|
+
def check_nn(nn_code: str, task: str, dataset: str, metric: str, prm: dict, save_to_db=True, ..., epoch_limit_minutes=30, ..., return_val=False) -> tuple
|
|
250
325
|
```
|
|
251
326
|
|
|
252
327
|
This function is the **submission endpoint** for new models.
|
|
253
328
|
|
|
254
|
-
1. **Input:** An external program (e.g., an LLM agent) provides the new model's `nn_code` (as a string), the `prm` dictionary, and the context (`task`, `dataset`, `metric`).
|
|
255
|
-
2. **Process:** The function automatically initiates the full training pipeline, running the code under standardized conditions
|
|
329
|
+
1. **Input:** An external program (e.g., an LLM agent) provides the new model's `nn_code` (as a string), the `prm` dictionary, and the context (`task`, `dataset`, `metric`). Besides the hyperparameters returned by the model's `supported_hyperparameters()`, `prm` must contain `'batch'`, `'epoch'` (number of epochs) and `'transform'` (the name of a module in `ab/nn/transform`).
|
|
330
|
+
2. **Process:** The function automatically initiates the full training pipeline, running the code under standardized conditions with a time limit per epoch (`epoch_limit_minutes`). With `save_to_db=True`, a model that reaches the minimum accuracy is stored in the database.
|
|
256
331
|
3. **Output:** It returns a tuple containing the key validated metrics, ready for consumption by an LLM or an external optimization loop:
|
|
257
332
|
* **NN Model Name (`str`):** An automatically generated unique ID for the archived model.
|
|
258
333
|
* **Accuracy (`float`):** The measured final performance.
|
|
259
334
|
* **Accuracy to Time Metric (`float`):** A single metric balancing performance against compute efficiency.
|
|
260
|
-
*
|
|
335
|
+
* With `return_val=True`, a fourth value: the validation accuracy of the last epoch (`None` without a validation set).
|
|
336
|
+
|
|
337
|
+
#### Example: Query and Validate
|
|
338
|
+
|
|
339
|
+
```python
|
|
340
|
+
from ab.nn.api import data, check_nn
|
|
341
|
+
|
|
342
|
+
# Best recorded AlexNet results on CIFAR-10 (downloads the database on first use)
|
|
343
|
+
df = data(only_best_accuracy=True, task='img-classification', dataset='cifar-10', metric='acc', nn='AlexNet')
|
|
344
|
+
print(df[['nn', 'epoch', 'accuracy', 'duration', 'prm']].head())
|
|
345
|
+
|
|
346
|
+
# Train and evaluate a model given as source code (here AlexNet's stored code) for one epoch
|
|
347
|
+
code = df['nn_code'].iloc[0]
|
|
348
|
+
prm = {'lr': 0.01, 'momentum': 0.9, 'dropout': 0.2, 'batch': 64, 'epoch': 1, 'transform': 'norm_64_flip'}
|
|
349
|
+
name, accuracy, accuracy_to_time = check_nn(code, 'img-classification', 'cifar-10', 'acc', prm, save_to_db=False)
|
|
350
|
+
print(name, accuracy, accuracy_to_time)
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
The second call downloads CIFAR-10 to `data/` and trains on a GPU if one is available.
|
|
261
354
|
|
|
262
355
|
#### 🚀 Get Started: Build Smarter, Train Less
|
|
263
356
|
|
|
@@ -266,11 +359,13 @@ The LEMUR API is designed for artificial agents, as well as for students and sci
|
|
|
266
359
|
2. **Focus on Generation:** Use `check_nn()` to automate the validation of your new, unique architectures.
|
|
267
360
|
3. **Computational Efficiency:** Prioritize allocation of high-cost computational resources (GPU/TPU) exclusively toward training novel architectures.
|
|
268
361
|
|
|
362
|
+
<a href='https://huggingface.co/NN-Dataset'><strong>Checkpoints</strong></a>
|
|
363
|
+
|
|
269
364
|
### 🐳 Docker
|
|
270
365
|
|
|
271
366
|
All versions of this project are compatible with <a href='https://hub.docker.com/r/abrainone/ai-linux' target='_blank'>AI Linux</a> and can be seamlessly executed within the AI Linux Docker container.
|
|
272
367
|
|
|
273
|
-
|
|
368
|
+
#### Example of training LEMUR neural network within the AI Linux container (Linux host)
|
|
274
369
|
|
|
275
370
|
Installing the latest version of the project from GitHub
|
|
276
371
|
```bash
|
|
@@ -279,14 +374,21 @@ docker run --rm -u $(id -u):ab -v $(pwd):/a/mm abrainone/ai-linux:cv bash -c "[
|
|
|
279
374
|
|
|
280
375
|
Running a quick training script:
|
|
281
376
|
```bash
|
|
282
|
-
docker run --rm -u $(id -u):ab --shm-size=16G -v $(pwd)/nn-dataset:/a/mm abrainone/ai-linux:cv bash -c ". train.sh -c img-classification_cifar-10_acc_ComplexNet -f complex -l 0.017 --min_learning_rate 0.013 -m 0.025 --min_momentum 0.022
|
|
377
|
+
docker run --rm -u $(id -u):ab --shm-size=16G -v $(pwd)/nn-dataset:/a/mm abrainone/ai-linux:cv bash -c ". train.sh -c img-classification_cifar-10_acc_ComplexNet -f complex -l 0.017 --min_learning_rate 0.013 -m 0.025 --min_momentum 0.022 --min_batch_binary_power 8 --max_batch_binary_power 9"
|
|
283
378
|
```
|
|
284
379
|
|
|
285
380
|
If recently added dependencies are missing in the <a href='https://hub.docker.com/r/abrainone/ai-linux' target='_blank'>AI Linux</a>, you can create a container from the Docker image ```abrainone/ai-linux:cv```, install the missing packages (preferably using ```pip install <package name>```), and then create a new image from the container using ```docker commit <container name> <new image name>```. You can use this new image locally or push it to the registry for deployment on the computer cluster.
|
|
286
381
|
|
|
382
|
+
## Support and Contributing
|
|
383
|
+
|
|
384
|
+
- **Questions and bug reports:** open an issue at https://github.com/ABrain-One/nn-dataset/issues.
|
|
385
|
+
- **Contributing code, models, or statistics:** see [CONTRIBUTING.md](CONTRIBUTING.md) for the development setup, tests, and pull-request process.
|
|
386
|
+
- **Code of conduct:** all participants are expected to follow the [Code of Conduct](CODE-OF-CONDUCT.md).
|
|
387
|
+
- **Release history:** see [CHANGELOG.md](CHANGELOG.md).
|
|
388
|
+
|
|
287
389
|
## Citation
|
|
288
390
|
|
|
289
|
-
If you find the LEMUR Neural Network Dataset to be useful for your research, please consider citing our <a target='_blank' href='https://arxiv.org/pdf/2504.10552'>
|
|
391
|
+
If you find the LEMUR Neural Network Dataset to be useful for your research, please consider citing our articles <a target='_blank' href='https://arxiv.org/pdf/2504.10552'>NN Dataset</a> and <a target='_blank' href='https://openaccess.thecvf.com/content/CVPR2026W/CVPR-NAS26/papers/Uzun_LEMUR_2_Unlocking_Neural_Network_Diversity_for_AI_CVPRW_2026_paper.pdf'>LEMUR 2</a>:
|
|
290
392
|
```bibtex
|
|
291
393
|
@article{ABrain.NN-Dataset,
|
|
292
394
|
title={LEMUR Neural Network Dataset: Towards Seamless AutoML},
|
|
@@ -295,11 +397,12 @@ If you find the LEMUR Neural Network Dataset to be useful for your research, ple
|
|
|
295
397
|
year={2025}
|
|
296
398
|
}
|
|
297
399
|
|
|
298
|
-
@
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
400
|
+
@InProceedings{ABrain.LEMUR2,
|
|
401
|
+
title={{LEMUR} 2: Unlocking Neural Network Diversity for {AI}},
|
|
402
|
+
author={Uzun, Tolgay Atinc and Khalid, Waleed and Din, Saif U and Mulukuledu, Sai Revanth and Singh, Akashdeep and Vysyaraju, Chandini and Duvvuri, Raghuvir and Goyal, Avi and Lukhi, Yashkumar Rajeshbhai and Hussain, Ahsan and Jesani, Krunal and Shrestha, Usha and Mittal, Yash and Kochnev, Roman and Kadam, Pritam and Ikram, Mohsin and Moradiya, Harsh Rameshbhai and Arslanian, Alice and Ignatov, Dmitry and Timofte, Radu},
|
|
403
|
+
booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVPRW)},
|
|
404
|
+
pages = {3291--3300},
|
|
405
|
+
year={2026}
|
|
303
406
|
}
|
|
304
407
|
```
|
|
305
408
|
|
|
@@ -6,36 +6,51 @@ LEMUR - Learning, Evaluation, and Modeling for Unified Research
|
|
|
6
6
|
|
|
7
7
|
<img src='https://abrain.one/img/lemur-nn-whit.jpg' width='25%'/>
|
|
8
8
|
|
|
9
|
-
The original version of the <a href='https://github.com/ABrain-One/
|
|
9
|
+
The original open-source version of the <a href='https://github.com/ABrain-One/NN-Dataset'>LEMUR dataset</a> was developed by <strong>Arash Torabi Goodarzi, Roman Kochnev</strong> and <strong>Zofia Antonina Bentyn</strong> at the Computer Vision Laboratory, University of Würzburg, Germany, under the supervision and technical guidance of <strong>Dr. Dmitry Ignatov</strong>, whose foundational work established the basis for the project.
|
|
10
10
|
|
|
11
11
|
## Contents
|
|
12
12
|
|
|
13
13
|
1. [📖 Overview](#-overview)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
- [Statement of Need](#statement-of-need)
|
|
15
|
+
- [Available Modules](#available-modules)
|
|
16
|
+
2. [Create and Activate a Virtual Environment](#create-and-activate-a-virtual-environment-recommended)
|
|
17
|
+
3. [Environment for NN Dataset Contributors](#environment-for-nn-dataset-contributors)
|
|
18
18
|
- [Pip Package Manager](#pip-package-manager)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
4. [Contribution: Adding a New Neural Network Model](#contribution)
|
|
20
|
+
5. [Installation or Update of the NN Dataset with pip](#installation-or-update-of-the-nn-dataset-with-pip)
|
|
21
|
+
- [Requirements, Network Access and Disk Space](#requirements-network-access-and-disk-space)
|
|
22
|
+
- [Optional Export Extras (TFLite / LiteRT)](#optional-export-extras-tflite--litert)
|
|
23
|
+
6. [Usage](#usage)
|
|
23
24
|
- [Standard Use Cases](#standard-use-cases)
|
|
24
25
|
- [Reproducing Results with Fixed Training Parameters](#reproducing-results-with-fixed-training-parameters)
|
|
25
26
|
- [View Supported Flags](#to-view-supported-flags)
|
|
26
|
-
|
|
27
|
+
7. [💻 API: Programmatic Access](#-api-programmatic-access)
|
|
27
28
|
- [Why the API is Important](#why-the-api-is-important)
|
|
28
29
|
- [Data Extraction and Mechanism](#data-extraction-and-mechanism)
|
|
29
30
|
- [The `data()` Function for Data Retrieval](#1-the-data-function-for-data-retrieval)
|
|
30
31
|
- [The `check_nn()` Function for NN Validation](#2-the-check_nn-function-for-nn-validation)
|
|
32
|
+
- [Example: Query and Validate](#example-query-and-validate)
|
|
31
33
|
- [🚀 Get Started: Build Smarter, Train Less](#-get-started-build-smarter-train-less)
|
|
32
|
-
|
|
33
|
-
- [Example of Training LEMUR Neural Network within AI Linux Container](#example-of-training-lemur-neural-network-within-ai-linux-container-linux-host)
|
|
34
|
+
8. [🐳 Docker](#-docker)
|
|
35
|
+
- [Example of Training LEMUR Neural Network within the AI Linux Container](#example-of-training-lemur-neural-network-within-the-ai-linux-container-linux-host)
|
|
36
|
+
9. [Support and Contributing](#support-and-contributing)
|
|
34
37
|
10. [Citation](#citation)
|
|
35
38
|
11. [Licenses](#licenses)
|
|
36
39
|
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
### 📖 Overview
|
|
41
|
+
|
|
42
|
+
NN Dataset project provides flexibility for dynamically combining various deep learning tasks, datasets, metrics, and neural network models. It is designed to facilitate the verification of neural network performance under various combinations of training hyperparameters and data transformation algorithms, by automatically generating performance statistics. Developed to support the <a href='https://github.com/ABrain-One/nn-gpt'>NNGPT</a> project, this dataset contains neural network models modified or generated by NNGPT's large language models, with names featuring alphanumeric postfixes (e.g., C10C-ResNetTransformer-e2b49b871c8b9a9014277a51b2348999).
|
|
43
|
+
|
|
44
|
+
### Statement of Need
|
|
45
|
+
|
|
46
|
+
Studies of neural network architectures and training procedures repeatedly need the same components: training code, a way to store results together with the model code and settings that produced them, and consistent measurements of accuracy, running time and resource use. LEMUR provides these in one package: a common model interface (each model, data loader, transformation and metric is a single Python file), a shared training pipeline built on PyTorch and Optuna, and a database that stores every epoch's result with its hyperparameters, transformation and hardware context. The records are queryable from Python through the [API](#-api-programmatic-access).
|
|
47
|
+
|
|
48
|
+
LEMUR is intended for:
|
|
49
|
+
- researchers running comparative studies across many architectures, who need a uniform training and evaluation procedure;
|
|
50
|
+
- AutoML and code-generation systems, such as <a href='https://github.com/ABrain-One/nn-gpt'>NNGPT</a>, that need candidate networks validated programmatically within a search loop;
|
|
51
|
+
- researchers and students who want to reuse existing measurements instead of recomputing them.
|
|
52
|
+
|
|
53
|
+
Model libraries such as `timm` provide implementations and weights, benchmarks such as NAS-Bench-101/201 provide results for fixed collections of architectures, and experiment trackers such as MLflow or Weights & Biases record runs that users train with their own code. LEMUR combines model code, a shared training and evaluation protocol, and linked, queryable records, and accepts new models as source code. See the [JOSS paper](paper/paper.md) for details.
|
|
39
54
|
|
|
40
55
|
### Available Modules
|
|
41
56
|
|
|
@@ -49,17 +64,18 @@ The `NN Dataset` includes the following key modules within the **<a href='https:
|
|
|
49
64
|
|
|
50
65
|
## Create and Activate a Virtual Environment (recommended)
|
|
51
66
|
For Linux/Mac:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
67
|
+
```bash
|
|
68
|
+
python3 -m venv .venv
|
|
69
|
+
source .venv/bin/activate
|
|
70
|
+
python -m pip install --upgrade pip
|
|
71
|
+
```
|
|
72
|
+
|
|
57
73
|
For Windows:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
74
|
+
```bash
|
|
75
|
+
python3 -m venv .venv
|
|
76
|
+
.venv\Scripts\activate
|
|
77
|
+
python -m pip install --upgrade pip
|
|
78
|
+
```
|
|
63
79
|
|
|
64
80
|
It is assumed that CUDA 13.0 is installed; otherwise, consider replacing 'cu130' with the appropriate version. Some neural network training tasks require GPUs with at least 24 GB of memory.
|
|
65
81
|
|
|
@@ -85,12 +101,12 @@ To contribute a new neural network (NN) model to the NN Dataset, please ensure t
|
|
|
85
101
|
4. All external information required for the correct building and training of the NN model for a specific dataset/transformer, as well as the list of hyperparameters, is extracted from <strong>in_shape</strong>, <strong>out_shape</strong> or <strong>prm</strong>, e.g.: </br>`batch = in_shape[0]` </br>`channel_number = in_shape[1]` </br>`image_size = in_shape[2]` </br>`class_number = out_shape[0]` </br>`learning_rate = prm['lr']` </br>`momentum = prm['momentum']` </br>`dropout = prm['dropout']`.
|
|
86
102
|
5. Every model script has function returning set of supported hyperparameters, e.g.: </br>`def supported_hyperparameters(): return {'lr', 'momentum', 'dropout'}`</br> The value of each hyperparameter lies within the range of 0.0 to 1.0.
|
|
87
103
|
6. Every class <strong>Net</strong> implements two functions: </br>`train_setup(self, prm)`</br> and </br>`learn(self, train_data)`</br> The first function initializes the `criteria` and `optimizer`, while the second implements the training pipeline. See a simple implementation in the <a href="https://github.com/ABrain-One/nn-dataset/blob/main/ab/nn/nn/AlexNet.py">AlexNet model</a>.
|
|
88
|
-
7. For each pull request involving a new NN model, please generate and submit training statistics for 10 Optuna trials (or at least 3 trials for very large models) in the <strong>ab/nn/stat</strong> directory. The trials should cover 5 epochs of training. Ensure that this statistics is included along with the model in your pull request. For example, the statistics for the ComplexNet model are stored in files <strong><epoch number>.json</strong> inside folder <strong>img-classification_cifar-10_acc_ComplexNet</strong>, and can be generated by:<br/>
|
|
104
|
+
7. For each pull request involving a new NN model, please generate and submit training statistics for 10 Optuna trials (or at least 3 trials for very large models) in the <strong>ab/nn/stat/train</strong> directory. The trials should cover 5 epochs of training. Ensure that this statistics is included along with the model in your pull request. For example, the statistics for the ComplexNet model are stored in files <strong><epoch number>.json</strong> inside folder <strong>ab/nn/stat/train/img-classification_cifar-10_acc_ComplexNet</strong>, and can be generated by:<br/>
|
|
89
105
|
```bash
|
|
90
|
-
python -m ab.nn.train -c img-classification_cifar-10_acc_ComplexNet -f complex -t
|
|
106
|
+
python -m ab.nn.train -c img-classification_cifar-10_acc_ComplexNet -f complex -t 10 -e 5
|
|
91
107
|
```
|
|
92
108
|
|
|
93
|
-
Before creating a pull request, run
|
|
109
|
+
Before creating a pull request, run the test suite as described in <a href="CONTRIBUTING.md#running-the-tests">CONTRIBUTING.md</a> to ensure that your changes do not break the core functionality of the NN Dataset.
|
|
94
110
|
|
|
95
111
|
<p>See more examples of models in <code>/ab/nn/nn</code> and generated statistics in <code>/ab/nn/stat</code>.</p>
|
|
96
112
|
|
|
@@ -120,24 +136,75 @@ Adding functionality to export data to Excel files and generate plots for <a hre
|
|
|
120
136
|
```bash
|
|
121
137
|
pip install nn-dataset[stat] --upgrade --extra-index-url https://download.pytorch.org/whl/cu130
|
|
122
138
|
```
|
|
123
|
-
and export/generate:
|
|
139
|
+
and export/generate (the `ab.stat` module is provided by the <a href='https://github.com/ABrain-One/nn-stat'>nn-stat</a> package installed by this extra):
|
|
124
140
|
```bash
|
|
125
141
|
python -m ab.stat.export
|
|
126
142
|
```
|
|
127
143
|
|
|
144
|
+
### Requirements, Network Access and Disk Space
|
|
145
|
+
|
|
146
|
+
- Python 3.10 or newer is required (the CI tests 3.10 and 3.11). All runtime dependencies are listed in <a href='requirements.txt'>requirements.txt</a> and are installed automatically by pip. The `--extra-index-url` only selects the CUDA 13.0 build of PyTorch; on other systems, replace `cu130` with your CUDA version or use `https://download.pytorch.org/whl/cpu`.
|
|
147
|
+
- Training uses an NVIDIA GPU when one is available and otherwise falls back to Apple MPS or the CPU, so small models and the API run on any machine; large studies are practical only on a GPU.
|
|
148
|
+
- **The first import downloads data.** Importing `ab.nn.api` or running `ab.nn.train` opens the LEMUR database `db/ab.nn.db` in the current working directory (in a cloned repository, its root). If the file does not exist, it is built from the statistics in `ab/nn/stat` when that folder is present (a full clone; this takes a while), and otherwise downloaded from the <a href='https://huggingface.co/NN-Dataset/LEMUR_DB'>LEMUR_DB</a> Hugging Face repository as `ab.nn.zst-<version>` (about 225 MB for version 2.2.11) and decompressed to `db/ab.nn.db`, which is larger than the download (the compressed file is removed afterwards).
|
|
149
|
+
- The database file is chosen by the installed package version. If the database of that version has not been published yet, e.g. for a development version installed from GitHub, the download fails with a 404 error; install the stable release from PyPI instead.
|
|
150
|
+
- Datasets are downloaded to `data/` when a pipeline first uses them (e.g. CIFAR-10), and training outputs are written to `out/`.
|
|
151
|
+
|
|
152
|
+
### Optional export extras (TFLite / LiteRT)
|
|
153
|
+
|
|
154
|
+
The TFLite export dependencies are **not** part of the default installation. Each
|
|
155
|
+
pins its own transitive versions, the two are mutually exclusive with each other,
|
|
156
|
+
and both conflict with environments that also contain vLLM. Install whichever one
|
|
157
|
+
you need into a **dedicated virtual environment**.
|
|
158
|
+
|
|
159
|
+
Running an existing `.tflite` model (inference only, no TensorFlow). This one is
|
|
160
|
+
light and installs cleanly next to the main requirements:
|
|
161
|
+
```bash
|
|
162
|
+
pip install nn-dataset[tflite-run]
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Converting ONNX → TFLite with `onnx2tf` (`util/py/age/convert_onnx_to_tflite_age.py`,
|
|
166
|
+
`demo/*`). Pulls full TensorFlow, so use a separate environment:
|
|
167
|
+
```bash
|
|
168
|
+
python -m venv .venv-tflite && . .venv-tflite/bin/activate
|
|
169
|
+
pip install nn-dataset[tflite]
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
PyTorch → TFLite through Google LiteRT (`litert-torch`), no Windows wheels:
|
|
173
|
+
```bash
|
|
174
|
+
python -m venv .venv-litert && . .venv-litert/bin/activate
|
|
175
|
+
pip install nn-dataset[litert]
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Why they are separate:
|
|
179
|
+
|
|
180
|
+
| Pin | Conflicts with |
|
|
181
|
+
|---|---|
|
|
182
|
+
| `onnx2tf` → `setuptools==81.0.0` | vLLM: `setuptools<81.0.0` |
|
|
183
|
+
| `onnx2tf` → `ai-edge-litert==2.1.2` | `litert-torch`: `ai-edge-litert>=2.3.0` |
|
|
184
|
+
| `onnx2tf` → `onnxruntime==1.26.0` | `onnxruntime-gpu` (same `onnxruntime` import namespace) |
|
|
185
|
+
| `litert-torch` → `xdsl==0.28.0` | `typing-extensions<4.13` vs vLLM → `pydantic>=2.12` needing `>=4.14.1` |
|
|
186
|
+
|
|
187
|
+
There is no lite-only converter: `tf.lite.TFLiteConverter` ships with full
|
|
188
|
+
TensorFlow, so `[tflite]` cannot be slimmed down. Only the inference side can,
|
|
189
|
+
which is what `[tflite-run]` is for.
|
|
190
|
+
|
|
191
|
+
Installing an extra alongside the main requirements in one environment will fail
|
|
192
|
+
to resolve. That is intentional — the alternative is a silently broken
|
|
193
|
+
environment.
|
|
194
|
+
|
|
128
195
|
## Usage
|
|
129
196
|
|
|
130
|
-
Standard
|
|
197
|
+
### Standard Use Cases
|
|
131
198
|
|
|
132
199
|
Run the automated training process for this model (e.g., a new ComplexNet training pipeline configuration):
|
|
133
200
|
```bash
|
|
134
|
-
python -m ab.nn.train -f complex -c img-classification_cifar-10_acc_ComplexNet -l 0.017 --min_learning_rate 0.013 -m 0.025 --min_momentum 0.022
|
|
201
|
+
python -m ab.nn.train -f complex -c img-classification_cifar-10_acc_ComplexNet -l 0.017 --min_learning_rate 0.013 -m 0.025 --min_momentum 0.022 --min_batch_binary_power 8 --max_batch_binary_power 9
|
|
135
202
|
```
|
|
136
203
|
or for all image segmentation models using a fixed range of training parameters and transformer:
|
|
137
204
|
```bash
|
|
138
205
|
. train.sh -c img-segmentation -f echo --min_learning_rate 1e-4 -l 1e-2 --min_momentum 0.8 -m 0.99 --min_batch_binary_power 2 -b 6
|
|
139
206
|
```
|
|
140
|
-
`train.sh` internally calls `ab.nn.train`, offering a shorter way to run the program. Both scripts accept the same input flags and can be used interchangeably.
|
|
207
|
+
`train.sh` internally calls `ab.nn.train`, offering a shorter way to run the program. Both scripts accept the same input flags and can be used interchangeably (on Windows, use `python -m ab.nn.train`).
|
|
141
208
|
|
|
142
209
|
##### Reproducing Results with Fixed Training Parameters
|
|
143
210
|
|
|
@@ -163,6 +230,8 @@ where:
|
|
|
163
230
|
. train.sh -h
|
|
164
231
|
```
|
|
165
232
|
|
|
233
|
+
To list the tasks, models and best accuracies stored in the database from a cloned repository, use `info.py` (see <a href='info_README.md'>info_README.md</a>).
|
|
234
|
+
|
|
166
235
|
**Add your new neural network model to the `ab/nn/nn` directory and proceed with your experiments (see [Contribution](#contribution) for details).**
|
|
167
236
|
|
|
168
237
|
|
|
@@ -175,7 +244,7 @@ The **LEMUR NN Dataset API** (`ab.nn.api`) is the dedicated programmatic interfa
|
|
|
175
244
|
The API solves the problem of **costly and time-consuming model validation**. By providing two distinct and powerful functions, it transforms the bottleneck of "waiting for results" into two key steps: instant query and automated validation.
|
|
176
245
|
|
|
177
246
|
1. **Enables Predictive Models:** Access to the full historical data allows researchers to train **performance prediction models** that can estimate a model's final accuracy *before* any training begins, saving massive amounts of compute time.
|
|
178
|
-
2. **Facilitates LLM Feedback:** The API acts as the crucial feedback mechanism for LLMs (like NNGPT). Generated architectures are validated via `check_nn`,
|
|
247
|
+
2. **Facilitates LLM Feedback:** The API acts as the crucial feedback mechanism for LLMs (like NNGPT). Generated architectures are validated via `check_nn`, their results are stored in the database and become available through `data()`, enabling the LLM to iteratively improve its quality based on its own outputs.
|
|
179
248
|
|
|
180
249
|
### Data Extraction and Mechanism
|
|
181
250
|
|
|
@@ -184,9 +253,11 @@ The core value of the API is the ability to retrieve complete, validated experim
|
|
|
184
253
|
#### 1. The `data()` Function for Data Retrieval
|
|
185
254
|
|
|
186
255
|
```python
|
|
187
|
-
def data(...) -> pandas.DataFrame
|
|
256
|
+
def data(only_best_accuracy=False, task=None, dataset=None, metric=None, nn=None, epoch=None, max_rows=None, ...) -> pandas.DataFrame
|
|
188
257
|
```
|
|
189
258
|
|
|
259
|
+
Each row also contains `'task'`, `'dataset'`, `'metric'`, `'metric_code'`, `'nn'`, `'epoch'` and `'transform_code'`. The main columns are:
|
|
260
|
+
|
|
190
261
|
| Data Type Extracted | DataFrame Column Name | Description |
|
|
191
262
|
| :--- | :--- | :--- |
|
|
192
263
|
| **Model Python Code** | `'nn_code'` | The **exact Python code (as a string)** defining the neural network's architecture. |
|
|
@@ -196,21 +267,41 @@ def data(...) -> pandas.DataFrame
|
|
|
196
267
|
|
|
197
268
|
**Mechanism:** Users filter the database using optional arguments (`task`, `dataset`, `nn`, etc.). The returned DataFrame allows external programs (such as statistical models or benchmark scripts) to easily consume the structured data for large-scale analysis. The optional `only_best_accuracy=True` ensures efficiency by returning only the best-performing trial for each unique configuration.
|
|
198
269
|
|
|
270
|
+
Further query functions in `ab.nn.api` return other record types as DataFrames: `run_data()` (on-device runtime and TFLite analytics), `prun_data()` (pruning results), `nn_stat_data()` (architecture statistics) and `layer_data()` (layer analysis). All arguments are described in the docstrings, e.g. `help(ab.nn.api.data)`.
|
|
271
|
+
|
|
199
272
|
#### 2. The `check_nn()` Function for NN Validation
|
|
200
273
|
|
|
201
274
|
```python
|
|
202
|
-
def check_nn(nn_code: str, task: str, dataset: str, metric: str, prm: dict,
|
|
275
|
+
def check_nn(nn_code: str, task: str, dataset: str, metric: str, prm: dict, save_to_db=True, ..., epoch_limit_minutes=30, ..., return_val=False) -> tuple
|
|
203
276
|
```
|
|
204
277
|
|
|
205
278
|
This function is the **submission endpoint** for new models.
|
|
206
279
|
|
|
207
|
-
1. **Input:** An external program (e.g., an LLM agent) provides the new model's `nn_code` (as a string), the `prm` dictionary, and the context (`task`, `dataset`, `metric`).
|
|
208
|
-
2. **Process:** The function automatically initiates the full training pipeline, running the code under standardized conditions
|
|
280
|
+
1. **Input:** An external program (e.g., an LLM agent) provides the new model's `nn_code` (as a string), the `prm` dictionary, and the context (`task`, `dataset`, `metric`). Besides the hyperparameters returned by the model's `supported_hyperparameters()`, `prm` must contain `'batch'`, `'epoch'` (number of epochs) and `'transform'` (the name of a module in `ab/nn/transform`).
|
|
281
|
+
2. **Process:** The function automatically initiates the full training pipeline, running the code under standardized conditions with a time limit per epoch (`epoch_limit_minutes`). With `save_to_db=True`, a model that reaches the minimum accuracy is stored in the database.
|
|
209
282
|
3. **Output:** It returns a tuple containing the key validated metrics, ready for consumption by an LLM or an external optimization loop:
|
|
210
283
|
* **NN Model Name (`str`):** An automatically generated unique ID for the archived model.
|
|
211
284
|
* **Accuracy (`float`):** The measured final performance.
|
|
212
285
|
* **Accuracy to Time Metric (`float`):** A single metric balancing performance against compute efficiency.
|
|
213
|
-
*
|
|
286
|
+
* With `return_val=True`, a fourth value: the validation accuracy of the last epoch (`None` without a validation set).
|
|
287
|
+
|
|
288
|
+
#### Example: Query and Validate
|
|
289
|
+
|
|
290
|
+
```python
|
|
291
|
+
from ab.nn.api import data, check_nn
|
|
292
|
+
|
|
293
|
+
# Best recorded AlexNet results on CIFAR-10 (downloads the database on first use)
|
|
294
|
+
df = data(only_best_accuracy=True, task='img-classification', dataset='cifar-10', metric='acc', nn='AlexNet')
|
|
295
|
+
print(df[['nn', 'epoch', 'accuracy', 'duration', 'prm']].head())
|
|
296
|
+
|
|
297
|
+
# Train and evaluate a model given as source code (here AlexNet's stored code) for one epoch
|
|
298
|
+
code = df['nn_code'].iloc[0]
|
|
299
|
+
prm = {'lr': 0.01, 'momentum': 0.9, 'dropout': 0.2, 'batch': 64, 'epoch': 1, 'transform': 'norm_64_flip'}
|
|
300
|
+
name, accuracy, accuracy_to_time = check_nn(code, 'img-classification', 'cifar-10', 'acc', prm, save_to_db=False)
|
|
301
|
+
print(name, accuracy, accuracy_to_time)
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
The second call downloads CIFAR-10 to `data/` and trains on a GPU if one is available.
|
|
214
305
|
|
|
215
306
|
#### 🚀 Get Started: Build Smarter, Train Less
|
|
216
307
|
|
|
@@ -219,11 +310,13 @@ The LEMUR API is designed for artificial agents, as well as for students and sci
|
|
|
219
310
|
2. **Focus on Generation:** Use `check_nn()` to automate the validation of your new, unique architectures.
|
|
220
311
|
3. **Computational Efficiency:** Prioritize allocation of high-cost computational resources (GPU/TPU) exclusively toward training novel architectures.
|
|
221
312
|
|
|
313
|
+
<a href='https://huggingface.co/NN-Dataset'><strong>Checkpoints</strong></a>
|
|
314
|
+
|
|
222
315
|
### 🐳 Docker
|
|
223
316
|
|
|
224
317
|
All versions of this project are compatible with <a href='https://hub.docker.com/r/abrainone/ai-linux' target='_blank'>AI Linux</a> and can be seamlessly executed within the AI Linux Docker container.
|
|
225
318
|
|
|
226
|
-
|
|
319
|
+
#### Example of training LEMUR neural network within the AI Linux container (Linux host)
|
|
227
320
|
|
|
228
321
|
Installing the latest version of the project from GitHub
|
|
229
322
|
```bash
|
|
@@ -232,14 +325,21 @@ docker run --rm -u $(id -u):ab -v $(pwd):/a/mm abrainone/ai-linux:cv bash -c "[
|
|
|
232
325
|
|
|
233
326
|
Running a quick training script:
|
|
234
327
|
```bash
|
|
235
|
-
docker run --rm -u $(id -u):ab --shm-size=16G -v $(pwd)/nn-dataset:/a/mm abrainone/ai-linux:cv bash -c ". train.sh -c img-classification_cifar-10_acc_ComplexNet -f complex -l 0.017 --min_learning_rate 0.013 -m 0.025 --min_momentum 0.022
|
|
328
|
+
docker run --rm -u $(id -u):ab --shm-size=16G -v $(pwd)/nn-dataset:/a/mm abrainone/ai-linux:cv bash -c ". train.sh -c img-classification_cifar-10_acc_ComplexNet -f complex -l 0.017 --min_learning_rate 0.013 -m 0.025 --min_momentum 0.022 --min_batch_binary_power 8 --max_batch_binary_power 9"
|
|
236
329
|
```
|
|
237
330
|
|
|
238
331
|
If recently added dependencies are missing in the <a href='https://hub.docker.com/r/abrainone/ai-linux' target='_blank'>AI Linux</a>, you can create a container from the Docker image ```abrainone/ai-linux:cv```, install the missing packages (preferably using ```pip install <package name>```), and then create a new image from the container using ```docker commit <container name> <new image name>```. You can use this new image locally or push it to the registry for deployment on the computer cluster.
|
|
239
332
|
|
|
333
|
+
## Support and Contributing
|
|
334
|
+
|
|
335
|
+
- **Questions and bug reports:** open an issue at https://github.com/ABrain-One/nn-dataset/issues.
|
|
336
|
+
- **Contributing code, models, or statistics:** see [CONTRIBUTING.md](CONTRIBUTING.md) for the development setup, tests, and pull-request process.
|
|
337
|
+
- **Code of conduct:** all participants are expected to follow the [Code of Conduct](CODE-OF-CONDUCT.md).
|
|
338
|
+
- **Release history:** see [CHANGELOG.md](CHANGELOG.md).
|
|
339
|
+
|
|
240
340
|
## Citation
|
|
241
341
|
|
|
242
|
-
If you find the LEMUR Neural Network Dataset to be useful for your research, please consider citing our <a target='_blank' href='https://arxiv.org/pdf/2504.10552'>
|
|
342
|
+
If you find the LEMUR Neural Network Dataset to be useful for your research, please consider citing our articles <a target='_blank' href='https://arxiv.org/pdf/2504.10552'>NN Dataset</a> and <a target='_blank' href='https://openaccess.thecvf.com/content/CVPR2026W/CVPR-NAS26/papers/Uzun_LEMUR_2_Unlocking_Neural_Network_Diversity_for_AI_CVPRW_2026_paper.pdf'>LEMUR 2</a>:
|
|
243
343
|
```bibtex
|
|
244
344
|
@article{ABrain.NN-Dataset,
|
|
245
345
|
title={LEMUR Neural Network Dataset: Towards Seamless AutoML},
|
|
@@ -248,11 +348,12 @@ If you find the LEMUR Neural Network Dataset to be useful for your research, ple
|
|
|
248
348
|
year={2025}
|
|
249
349
|
}
|
|
250
350
|
|
|
251
|
-
@
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
351
|
+
@InProceedings{ABrain.LEMUR2,
|
|
352
|
+
title={{LEMUR} 2: Unlocking Neural Network Diversity for {AI}},
|
|
353
|
+
author={Uzun, Tolgay Atinc and Khalid, Waleed and Din, Saif U and Mulukuledu, Sai Revanth and Singh, Akashdeep and Vysyaraju, Chandini and Duvvuri, Raghuvir and Goyal, Avi and Lukhi, Yashkumar Rajeshbhai and Hussain, Ahsan and Jesani, Krunal and Shrestha, Usha and Mittal, Yash and Kochnev, Roman and Kadam, Pritam and Ikram, Mohsin and Moradiya, Harsh Rameshbhai and Arslanian, Alice and Ignatov, Dmitry and Timofte, Radu},
|
|
354
|
+
booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVPRW)},
|
|
355
|
+
pages = {3291--3300},
|
|
356
|
+
year={2026}
|
|
256
357
|
}
|
|
257
358
|
```
|
|
258
359
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lmur
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.14
|
|
4
4
|
Summary: Neural Network Dataset
|
|
5
5
|
Author-email: ABrain One and contributors <AI@ABrain.one>
|
|
6
6
|
License: MIT License
|
|
7
7
|
|
|
8
|
-
Copyright (c) 2024- ABrain
|
|
8
|
+
Copyright (c) 2024- ABrain-One and contributors
|
|
9
9
|
All rights reserved.
|
|
10
10
|
|
|
11
11
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
@@ -40,9 +40,11 @@ Classifier: Intended Audience :: Science/Research
|
|
|
40
40
|
Requires-Python: >=3.10
|
|
41
41
|
Description-Content-Type: text/markdown
|
|
42
42
|
License-File: LICENSE
|
|
43
|
-
Requires-Dist: nn-dataset==2.2.
|
|
43
|
+
Requires-Dist: nn-dataset==2.2.14
|
|
44
44
|
Provides-Extra: stat
|
|
45
|
-
|
|
45
|
+
Provides-Extra: tflite
|
|
46
|
+
Provides-Extra: tflite-run
|
|
47
|
+
Provides-Extra: litert
|
|
46
48
|
Dynamic: license-file
|
|
47
49
|
|
|
48
50
|
## <img src='https://abrain.one/img/lemur-nn-icon-64x64.png' width='32px'/> Neural Network Dataset
|
|
@@ -53,36 +55,51 @@ LEMUR - Learning, Evaluation, and Modeling for Unified Research
|
|
|
53
55
|
|
|
54
56
|
<img src='https://abrain.one/img/lemur-nn-whit.jpg' width='25%'/>
|
|
55
57
|
|
|
56
|
-
The original version of the <a href='https://github.com/ABrain-One/
|
|
58
|
+
The original open-source version of the <a href='https://github.com/ABrain-One/NN-Dataset'>LEMUR dataset</a> was developed by <strong>Arash Torabi Goodarzi, Roman Kochnev</strong> and <strong>Zofia Antonina Bentyn</strong> at the Computer Vision Laboratory, University of Würzburg, Germany, under the supervision and technical guidance of <strong>Dr. Dmitry Ignatov</strong>, whose foundational work established the basis for the project.
|
|
57
59
|
|
|
58
60
|
## Contents
|
|
59
61
|
|
|
60
62
|
1. [📖 Overview](#-overview)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
- [Statement of Need](#statement-of-need)
|
|
64
|
+
- [Available Modules](#available-modules)
|
|
65
|
+
2. [Create and Activate a Virtual Environment](#create-and-activate-a-virtual-environment-recommended)
|
|
66
|
+
3. [Environment for NN Dataset Contributors](#environment-for-nn-dataset-contributors)
|
|
65
67
|
- [Pip Package Manager](#pip-package-manager)
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
4. [Contribution: Adding a New Neural Network Model](#contribution)
|
|
69
|
+
5. [Installation or Update of the NN Dataset with pip](#installation-or-update-of-the-nn-dataset-with-pip)
|
|
70
|
+
- [Requirements, Network Access and Disk Space](#requirements-network-access-and-disk-space)
|
|
71
|
+
- [Optional Export Extras (TFLite / LiteRT)](#optional-export-extras-tflite--litert)
|
|
72
|
+
6. [Usage](#usage)
|
|
70
73
|
- [Standard Use Cases](#standard-use-cases)
|
|
71
74
|
- [Reproducing Results with Fixed Training Parameters](#reproducing-results-with-fixed-training-parameters)
|
|
72
75
|
- [View Supported Flags](#to-view-supported-flags)
|
|
73
|
-
|
|
76
|
+
7. [💻 API: Programmatic Access](#-api-programmatic-access)
|
|
74
77
|
- [Why the API is Important](#why-the-api-is-important)
|
|
75
78
|
- [Data Extraction and Mechanism](#data-extraction-and-mechanism)
|
|
76
79
|
- [The `data()` Function for Data Retrieval](#1-the-data-function-for-data-retrieval)
|
|
77
80
|
- [The `check_nn()` Function for NN Validation](#2-the-check_nn-function-for-nn-validation)
|
|
81
|
+
- [Example: Query and Validate](#example-query-and-validate)
|
|
78
82
|
- [🚀 Get Started: Build Smarter, Train Less](#-get-started-build-smarter-train-less)
|
|
79
|
-
|
|
80
|
-
- [Example of Training LEMUR Neural Network within AI Linux Container](#example-of-training-lemur-neural-network-within-ai-linux-container-linux-host)
|
|
83
|
+
8. [🐳 Docker](#-docker)
|
|
84
|
+
- [Example of Training LEMUR Neural Network within the AI Linux Container](#example-of-training-lemur-neural-network-within-the-ai-linux-container-linux-host)
|
|
85
|
+
9. [Support and Contributing](#support-and-contributing)
|
|
81
86
|
10. [Citation](#citation)
|
|
82
87
|
11. [Licenses](#licenses)
|
|
83
88
|
|
|
84
|
-
|
|
85
|
-
|
|
89
|
+
### 📖 Overview
|
|
90
|
+
|
|
91
|
+
NN Dataset project provides flexibility for dynamically combining various deep learning tasks, datasets, metrics, and neural network models. It is designed to facilitate the verification of neural network performance under various combinations of training hyperparameters and data transformation algorithms, by automatically generating performance statistics. Developed to support the <a href='https://github.com/ABrain-One/nn-gpt'>NNGPT</a> project, this dataset contains neural network models modified or generated by NNGPT's large language models, with names featuring alphanumeric postfixes (e.g., C10C-ResNetTransformer-e2b49b871c8b9a9014277a51b2348999).
|
|
92
|
+
|
|
93
|
+
### Statement of Need
|
|
94
|
+
|
|
95
|
+
Studies of neural network architectures and training procedures repeatedly need the same components: training code, a way to store results together with the model code and settings that produced them, and consistent measurements of accuracy, running time and resource use. LEMUR provides these in one package: a common model interface (each model, data loader, transformation and metric is a single Python file), a shared training pipeline built on PyTorch and Optuna, and a database that stores every epoch's result with its hyperparameters, transformation and hardware context. The records are queryable from Python through the [API](#-api-programmatic-access).
|
|
96
|
+
|
|
97
|
+
LEMUR is intended for:
|
|
98
|
+
- researchers running comparative studies across many architectures, who need a uniform training and evaluation procedure;
|
|
99
|
+
- AutoML and code-generation systems, such as <a href='https://github.com/ABrain-One/nn-gpt'>NNGPT</a>, that need candidate networks validated programmatically within a search loop;
|
|
100
|
+
- researchers and students who want to reuse existing measurements instead of recomputing them.
|
|
101
|
+
|
|
102
|
+
Model libraries such as `timm` provide implementations and weights, benchmarks such as NAS-Bench-101/201 provide results for fixed collections of architectures, and experiment trackers such as MLflow or Weights & Biases record runs that users train with their own code. LEMUR combines model code, a shared training and evaluation protocol, and linked, queryable records, and accepts new models as source code. See the [JOSS paper](paper/paper.md) for details.
|
|
86
103
|
|
|
87
104
|
### Available Modules
|
|
88
105
|
|
|
@@ -96,17 +113,18 @@ The `NN Dataset` includes the following key modules within the **<a href='https:
|
|
|
96
113
|
|
|
97
114
|
## Create and Activate a Virtual Environment (recommended)
|
|
98
115
|
For Linux/Mac:
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
116
|
+
```bash
|
|
117
|
+
python3 -m venv .venv
|
|
118
|
+
source .venv/bin/activate
|
|
119
|
+
python -m pip install --upgrade pip
|
|
120
|
+
```
|
|
121
|
+
|
|
104
122
|
For Windows:
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
123
|
+
```bash
|
|
124
|
+
python3 -m venv .venv
|
|
125
|
+
.venv\Scripts\activate
|
|
126
|
+
python -m pip install --upgrade pip
|
|
127
|
+
```
|
|
110
128
|
|
|
111
129
|
It is assumed that CUDA 13.0 is installed; otherwise, consider replacing 'cu130' with the appropriate version. Some neural network training tasks require GPUs with at least 24 GB of memory.
|
|
112
130
|
|
|
@@ -132,12 +150,12 @@ To contribute a new neural network (NN) model to the NN Dataset, please ensure t
|
|
|
132
150
|
4. All external information required for the correct building and training of the NN model for a specific dataset/transformer, as well as the list of hyperparameters, is extracted from <strong>in_shape</strong>, <strong>out_shape</strong> or <strong>prm</strong>, e.g.: </br>`batch = in_shape[0]` </br>`channel_number = in_shape[1]` </br>`image_size = in_shape[2]` </br>`class_number = out_shape[0]` </br>`learning_rate = prm['lr']` </br>`momentum = prm['momentum']` </br>`dropout = prm['dropout']`.
|
|
133
151
|
5. Every model script has function returning set of supported hyperparameters, e.g.: </br>`def supported_hyperparameters(): return {'lr', 'momentum', 'dropout'}`</br> The value of each hyperparameter lies within the range of 0.0 to 1.0.
|
|
134
152
|
6. Every class <strong>Net</strong> implements two functions: </br>`train_setup(self, prm)`</br> and </br>`learn(self, train_data)`</br> The first function initializes the `criteria` and `optimizer`, while the second implements the training pipeline. See a simple implementation in the <a href="https://github.com/ABrain-One/nn-dataset/blob/main/ab/nn/nn/AlexNet.py">AlexNet model</a>.
|
|
135
|
-
7. For each pull request involving a new NN model, please generate and submit training statistics for 10 Optuna trials (or at least 3 trials for very large models) in the <strong>ab/nn/stat</strong> directory. The trials should cover 5 epochs of training. Ensure that this statistics is included along with the model in your pull request. For example, the statistics for the ComplexNet model are stored in files <strong><epoch number>.json</strong> inside folder <strong>img-classification_cifar-10_acc_ComplexNet</strong>, and can be generated by:<br/>
|
|
153
|
+
7. For each pull request involving a new NN model, please generate and submit training statistics for 10 Optuna trials (or at least 3 trials for very large models) in the <strong>ab/nn/stat/train</strong> directory. The trials should cover 5 epochs of training. Ensure that this statistics is included along with the model in your pull request. For example, the statistics for the ComplexNet model are stored in files <strong><epoch number>.json</strong> inside folder <strong>ab/nn/stat/train/img-classification_cifar-10_acc_ComplexNet</strong>, and can be generated by:<br/>
|
|
136
154
|
```bash
|
|
137
|
-
python -m ab.nn.train -c img-classification_cifar-10_acc_ComplexNet -f complex -t
|
|
155
|
+
python -m ab.nn.train -c img-classification_cifar-10_acc_ComplexNet -f complex -t 10 -e 5
|
|
138
156
|
```
|
|
139
157
|
|
|
140
|
-
Before creating a pull request, run
|
|
158
|
+
Before creating a pull request, run the test suite as described in <a href="CONTRIBUTING.md#running-the-tests">CONTRIBUTING.md</a> to ensure that your changes do not break the core functionality of the NN Dataset.
|
|
141
159
|
|
|
142
160
|
<p>See more examples of models in <code>/ab/nn/nn</code> and generated statistics in <code>/ab/nn/stat</code>.</p>
|
|
143
161
|
|
|
@@ -167,24 +185,75 @@ Adding functionality to export data to Excel files and generate plots for <a hre
|
|
|
167
185
|
```bash
|
|
168
186
|
pip install nn-dataset[stat] --upgrade --extra-index-url https://download.pytorch.org/whl/cu130
|
|
169
187
|
```
|
|
170
|
-
and export/generate:
|
|
188
|
+
and export/generate (the `ab.stat` module is provided by the <a href='https://github.com/ABrain-One/nn-stat'>nn-stat</a> package installed by this extra):
|
|
171
189
|
```bash
|
|
172
190
|
python -m ab.stat.export
|
|
173
191
|
```
|
|
174
192
|
|
|
193
|
+
### Requirements, Network Access and Disk Space
|
|
194
|
+
|
|
195
|
+
- Python 3.10 or newer is required (the CI tests 3.10 and 3.11). All runtime dependencies are listed in <a href='requirements.txt'>requirements.txt</a> and are installed automatically by pip. The `--extra-index-url` only selects the CUDA 13.0 build of PyTorch; on other systems, replace `cu130` with your CUDA version or use `https://download.pytorch.org/whl/cpu`.
|
|
196
|
+
- Training uses an NVIDIA GPU when one is available and otherwise falls back to Apple MPS or the CPU, so small models and the API run on any machine; large studies are practical only on a GPU.
|
|
197
|
+
- **The first import downloads data.** Importing `ab.nn.api` or running `ab.nn.train` opens the LEMUR database `db/ab.nn.db` in the current working directory (in a cloned repository, its root). If the file does not exist, it is built from the statistics in `ab/nn/stat` when that folder is present (a full clone; this takes a while), and otherwise downloaded from the <a href='https://huggingface.co/NN-Dataset/LEMUR_DB'>LEMUR_DB</a> Hugging Face repository as `ab.nn.zst-<version>` (about 225 MB for version 2.2.11) and decompressed to `db/ab.nn.db`, which is larger than the download (the compressed file is removed afterwards).
|
|
198
|
+
- The database file is chosen by the installed package version. If the database of that version has not been published yet, e.g. for a development version installed from GitHub, the download fails with a 404 error; install the stable release from PyPI instead.
|
|
199
|
+
- Datasets are downloaded to `data/` when a pipeline first uses them (e.g. CIFAR-10), and training outputs are written to `out/`.
|
|
200
|
+
|
|
201
|
+
### Optional export extras (TFLite / LiteRT)
|
|
202
|
+
|
|
203
|
+
The TFLite export dependencies are **not** part of the default installation. Each
|
|
204
|
+
pins its own transitive versions, the two are mutually exclusive with each other,
|
|
205
|
+
and both conflict with environments that also contain vLLM. Install whichever one
|
|
206
|
+
you need into a **dedicated virtual environment**.
|
|
207
|
+
|
|
208
|
+
Running an existing `.tflite` model (inference only, no TensorFlow). This one is
|
|
209
|
+
light and installs cleanly next to the main requirements:
|
|
210
|
+
```bash
|
|
211
|
+
pip install nn-dataset[tflite-run]
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Converting ONNX → TFLite with `onnx2tf` (`util/py/age/convert_onnx_to_tflite_age.py`,
|
|
215
|
+
`demo/*`). Pulls full TensorFlow, so use a separate environment:
|
|
216
|
+
```bash
|
|
217
|
+
python -m venv .venv-tflite && . .venv-tflite/bin/activate
|
|
218
|
+
pip install nn-dataset[tflite]
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
PyTorch → TFLite through Google LiteRT (`litert-torch`), no Windows wheels:
|
|
222
|
+
```bash
|
|
223
|
+
python -m venv .venv-litert && . .venv-litert/bin/activate
|
|
224
|
+
pip install nn-dataset[litert]
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Why they are separate:
|
|
228
|
+
|
|
229
|
+
| Pin | Conflicts with |
|
|
230
|
+
|---|---|
|
|
231
|
+
| `onnx2tf` → `setuptools==81.0.0` | vLLM: `setuptools<81.0.0` |
|
|
232
|
+
| `onnx2tf` → `ai-edge-litert==2.1.2` | `litert-torch`: `ai-edge-litert>=2.3.0` |
|
|
233
|
+
| `onnx2tf` → `onnxruntime==1.26.0` | `onnxruntime-gpu` (same `onnxruntime` import namespace) |
|
|
234
|
+
| `litert-torch` → `xdsl==0.28.0` | `typing-extensions<4.13` vs vLLM → `pydantic>=2.12` needing `>=4.14.1` |
|
|
235
|
+
|
|
236
|
+
There is no lite-only converter: `tf.lite.TFLiteConverter` ships with full
|
|
237
|
+
TensorFlow, so `[tflite]` cannot be slimmed down. Only the inference side can,
|
|
238
|
+
which is what `[tflite-run]` is for.
|
|
239
|
+
|
|
240
|
+
Installing an extra alongside the main requirements in one environment will fail
|
|
241
|
+
to resolve. That is intentional — the alternative is a silently broken
|
|
242
|
+
environment.
|
|
243
|
+
|
|
175
244
|
## Usage
|
|
176
245
|
|
|
177
|
-
Standard
|
|
246
|
+
### Standard Use Cases
|
|
178
247
|
|
|
179
248
|
Run the automated training process for this model (e.g., a new ComplexNet training pipeline configuration):
|
|
180
249
|
```bash
|
|
181
|
-
python -m ab.nn.train -f complex -c img-classification_cifar-10_acc_ComplexNet -l 0.017 --min_learning_rate 0.013 -m 0.025 --min_momentum 0.022
|
|
250
|
+
python -m ab.nn.train -f complex -c img-classification_cifar-10_acc_ComplexNet -l 0.017 --min_learning_rate 0.013 -m 0.025 --min_momentum 0.022 --min_batch_binary_power 8 --max_batch_binary_power 9
|
|
182
251
|
```
|
|
183
252
|
or for all image segmentation models using a fixed range of training parameters and transformer:
|
|
184
253
|
```bash
|
|
185
254
|
. train.sh -c img-segmentation -f echo --min_learning_rate 1e-4 -l 1e-2 --min_momentum 0.8 -m 0.99 --min_batch_binary_power 2 -b 6
|
|
186
255
|
```
|
|
187
|
-
`train.sh` internally calls `ab.nn.train`, offering a shorter way to run the program. Both scripts accept the same input flags and can be used interchangeably.
|
|
256
|
+
`train.sh` internally calls `ab.nn.train`, offering a shorter way to run the program. Both scripts accept the same input flags and can be used interchangeably (on Windows, use `python -m ab.nn.train`).
|
|
188
257
|
|
|
189
258
|
##### Reproducing Results with Fixed Training Parameters
|
|
190
259
|
|
|
@@ -210,6 +279,8 @@ where:
|
|
|
210
279
|
. train.sh -h
|
|
211
280
|
```
|
|
212
281
|
|
|
282
|
+
To list the tasks, models and best accuracies stored in the database from a cloned repository, use `info.py` (see <a href='info_README.md'>info_README.md</a>).
|
|
283
|
+
|
|
213
284
|
**Add your new neural network model to the `ab/nn/nn` directory and proceed with your experiments (see [Contribution](#contribution) for details).**
|
|
214
285
|
|
|
215
286
|
|
|
@@ -222,7 +293,7 @@ The **LEMUR NN Dataset API** (`ab.nn.api`) is the dedicated programmatic interfa
|
|
|
222
293
|
The API solves the problem of **costly and time-consuming model validation**. By providing two distinct and powerful functions, it transforms the bottleneck of "waiting for results" into two key steps: instant query and automated validation.
|
|
223
294
|
|
|
224
295
|
1. **Enables Predictive Models:** Access to the full historical data allows researchers to train **performance prediction models** that can estimate a model's final accuracy *before* any training begins, saving massive amounts of compute time.
|
|
225
|
-
2. **Facilitates LLM Feedback:** The API acts as the crucial feedback mechanism for LLMs (like NNGPT). Generated architectures are validated via `check_nn`,
|
|
296
|
+
2. **Facilitates LLM Feedback:** The API acts as the crucial feedback mechanism for LLMs (like NNGPT). Generated architectures are validated via `check_nn`, their results are stored in the database and become available through `data()`, enabling the LLM to iteratively improve its quality based on its own outputs.
|
|
226
297
|
|
|
227
298
|
### Data Extraction and Mechanism
|
|
228
299
|
|
|
@@ -231,9 +302,11 @@ The core value of the API is the ability to retrieve complete, validated experim
|
|
|
231
302
|
#### 1. The `data()` Function for Data Retrieval
|
|
232
303
|
|
|
233
304
|
```python
|
|
234
|
-
def data(...) -> pandas.DataFrame
|
|
305
|
+
def data(only_best_accuracy=False, task=None, dataset=None, metric=None, nn=None, epoch=None, max_rows=None, ...) -> pandas.DataFrame
|
|
235
306
|
```
|
|
236
307
|
|
|
308
|
+
Each row also contains `'task'`, `'dataset'`, `'metric'`, `'metric_code'`, `'nn'`, `'epoch'` and `'transform_code'`. The main columns are:
|
|
309
|
+
|
|
237
310
|
| Data Type Extracted | DataFrame Column Name | Description |
|
|
238
311
|
| :--- | :--- | :--- |
|
|
239
312
|
| **Model Python Code** | `'nn_code'` | The **exact Python code (as a string)** defining the neural network's architecture. |
|
|
@@ -243,21 +316,41 @@ def data(...) -> pandas.DataFrame
|
|
|
243
316
|
|
|
244
317
|
**Mechanism:** Users filter the database using optional arguments (`task`, `dataset`, `nn`, etc.). The returned DataFrame allows external programs (such as statistical models or benchmark scripts) to easily consume the structured data for large-scale analysis. The optional `only_best_accuracy=True` ensures efficiency by returning only the best-performing trial for each unique configuration.
|
|
245
318
|
|
|
319
|
+
Further query functions in `ab.nn.api` return other record types as DataFrames: `run_data()` (on-device runtime and TFLite analytics), `prun_data()` (pruning results), `nn_stat_data()` (architecture statistics) and `layer_data()` (layer analysis). All arguments are described in the docstrings, e.g. `help(ab.nn.api.data)`.
|
|
320
|
+
|
|
246
321
|
#### 2. The `check_nn()` Function for NN Validation
|
|
247
322
|
|
|
248
323
|
```python
|
|
249
|
-
def check_nn(nn_code: str, task: str, dataset: str, metric: str, prm: dict,
|
|
324
|
+
def check_nn(nn_code: str, task: str, dataset: str, metric: str, prm: dict, save_to_db=True, ..., epoch_limit_minutes=30, ..., return_val=False) -> tuple
|
|
250
325
|
```
|
|
251
326
|
|
|
252
327
|
This function is the **submission endpoint** for new models.
|
|
253
328
|
|
|
254
|
-
1. **Input:** An external program (e.g., an LLM agent) provides the new model's `nn_code` (as a string), the `prm` dictionary, and the context (`task`, `dataset`, `metric`).
|
|
255
|
-
2. **Process:** The function automatically initiates the full training pipeline, running the code under standardized conditions
|
|
329
|
+
1. **Input:** An external program (e.g., an LLM agent) provides the new model's `nn_code` (as a string), the `prm` dictionary, and the context (`task`, `dataset`, `metric`). Besides the hyperparameters returned by the model's `supported_hyperparameters()`, `prm` must contain `'batch'`, `'epoch'` (number of epochs) and `'transform'` (the name of a module in `ab/nn/transform`).
|
|
330
|
+
2. **Process:** The function automatically initiates the full training pipeline, running the code under standardized conditions with a time limit per epoch (`epoch_limit_minutes`). With `save_to_db=True`, a model that reaches the minimum accuracy is stored in the database.
|
|
256
331
|
3. **Output:** It returns a tuple containing the key validated metrics, ready for consumption by an LLM or an external optimization loop:
|
|
257
332
|
* **NN Model Name (`str`):** An automatically generated unique ID for the archived model.
|
|
258
333
|
* **Accuracy (`float`):** The measured final performance.
|
|
259
334
|
* **Accuracy to Time Metric (`float`):** A single metric balancing performance against compute efficiency.
|
|
260
|
-
*
|
|
335
|
+
* With `return_val=True`, a fourth value: the validation accuracy of the last epoch (`None` without a validation set).
|
|
336
|
+
|
|
337
|
+
#### Example: Query and Validate
|
|
338
|
+
|
|
339
|
+
```python
|
|
340
|
+
from ab.nn.api import data, check_nn
|
|
341
|
+
|
|
342
|
+
# Best recorded AlexNet results on CIFAR-10 (downloads the database on first use)
|
|
343
|
+
df = data(only_best_accuracy=True, task='img-classification', dataset='cifar-10', metric='acc', nn='AlexNet')
|
|
344
|
+
print(df[['nn', 'epoch', 'accuracy', 'duration', 'prm']].head())
|
|
345
|
+
|
|
346
|
+
# Train and evaluate a model given as source code (here AlexNet's stored code) for one epoch
|
|
347
|
+
code = df['nn_code'].iloc[0]
|
|
348
|
+
prm = {'lr': 0.01, 'momentum': 0.9, 'dropout': 0.2, 'batch': 64, 'epoch': 1, 'transform': 'norm_64_flip'}
|
|
349
|
+
name, accuracy, accuracy_to_time = check_nn(code, 'img-classification', 'cifar-10', 'acc', prm, save_to_db=False)
|
|
350
|
+
print(name, accuracy, accuracy_to_time)
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
The second call downloads CIFAR-10 to `data/` and trains on a GPU if one is available.
|
|
261
354
|
|
|
262
355
|
#### 🚀 Get Started: Build Smarter, Train Less
|
|
263
356
|
|
|
@@ -266,11 +359,13 @@ The LEMUR API is designed for artificial agents, as well as for students and sci
|
|
|
266
359
|
2. **Focus on Generation:** Use `check_nn()` to automate the validation of your new, unique architectures.
|
|
267
360
|
3. **Computational Efficiency:** Prioritize allocation of high-cost computational resources (GPU/TPU) exclusively toward training novel architectures.
|
|
268
361
|
|
|
362
|
+
<a href='https://huggingface.co/NN-Dataset'><strong>Checkpoints</strong></a>
|
|
363
|
+
|
|
269
364
|
### 🐳 Docker
|
|
270
365
|
|
|
271
366
|
All versions of this project are compatible with <a href='https://hub.docker.com/r/abrainone/ai-linux' target='_blank'>AI Linux</a> and can be seamlessly executed within the AI Linux Docker container.
|
|
272
367
|
|
|
273
|
-
|
|
368
|
+
#### Example of training LEMUR neural network within the AI Linux container (Linux host)
|
|
274
369
|
|
|
275
370
|
Installing the latest version of the project from GitHub
|
|
276
371
|
```bash
|
|
@@ -279,14 +374,21 @@ docker run --rm -u $(id -u):ab -v $(pwd):/a/mm abrainone/ai-linux:cv bash -c "[
|
|
|
279
374
|
|
|
280
375
|
Running a quick training script:
|
|
281
376
|
```bash
|
|
282
|
-
docker run --rm -u $(id -u):ab --shm-size=16G -v $(pwd)/nn-dataset:/a/mm abrainone/ai-linux:cv bash -c ". train.sh -c img-classification_cifar-10_acc_ComplexNet -f complex -l 0.017 --min_learning_rate 0.013 -m 0.025 --min_momentum 0.022
|
|
377
|
+
docker run --rm -u $(id -u):ab --shm-size=16G -v $(pwd)/nn-dataset:/a/mm abrainone/ai-linux:cv bash -c ". train.sh -c img-classification_cifar-10_acc_ComplexNet -f complex -l 0.017 --min_learning_rate 0.013 -m 0.025 --min_momentum 0.022 --min_batch_binary_power 8 --max_batch_binary_power 9"
|
|
283
378
|
```
|
|
284
379
|
|
|
285
380
|
If recently added dependencies are missing in the <a href='https://hub.docker.com/r/abrainone/ai-linux' target='_blank'>AI Linux</a>, you can create a container from the Docker image ```abrainone/ai-linux:cv```, install the missing packages (preferably using ```pip install <package name>```), and then create a new image from the container using ```docker commit <container name> <new image name>```. You can use this new image locally or push it to the registry for deployment on the computer cluster.
|
|
286
381
|
|
|
382
|
+
## Support and Contributing
|
|
383
|
+
|
|
384
|
+
- **Questions and bug reports:** open an issue at https://github.com/ABrain-One/nn-dataset/issues.
|
|
385
|
+
- **Contributing code, models, or statistics:** see [CONTRIBUTING.md](CONTRIBUTING.md) for the development setup, tests, and pull-request process.
|
|
386
|
+
- **Code of conduct:** all participants are expected to follow the [Code of Conduct](CODE-OF-CONDUCT.md).
|
|
387
|
+
- **Release history:** see [CHANGELOG.md](CHANGELOG.md).
|
|
388
|
+
|
|
287
389
|
## Citation
|
|
288
390
|
|
|
289
|
-
If you find the LEMUR Neural Network Dataset to be useful for your research, please consider citing our <a target='_blank' href='https://arxiv.org/pdf/2504.10552'>
|
|
391
|
+
If you find the LEMUR Neural Network Dataset to be useful for your research, please consider citing our articles <a target='_blank' href='https://arxiv.org/pdf/2504.10552'>NN Dataset</a> and <a target='_blank' href='https://openaccess.thecvf.com/content/CVPR2026W/CVPR-NAS26/papers/Uzun_LEMUR_2_Unlocking_Neural_Network_Diversity_for_AI_CVPRW_2026_paper.pdf'>LEMUR 2</a>:
|
|
290
392
|
```bibtex
|
|
291
393
|
@article{ABrain.NN-Dataset,
|
|
292
394
|
title={LEMUR Neural Network Dataset: Towards Seamless AutoML},
|
|
@@ -295,11 +397,12 @@ If you find the LEMUR Neural Network Dataset to be useful for your research, ple
|
|
|
295
397
|
year={2025}
|
|
296
398
|
}
|
|
297
399
|
|
|
298
|
-
@
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
400
|
+
@InProceedings{ABrain.LEMUR2,
|
|
401
|
+
title={{LEMUR} 2: Unlocking Neural Network Diversity for {AI}},
|
|
402
|
+
author={Uzun, Tolgay Atinc and Khalid, Waleed and Din, Saif U and Mulukuledu, Sai Revanth and Singh, Akashdeep and Vysyaraju, Chandini and Duvvuri, Raghuvir and Goyal, Avi and Lukhi, Yashkumar Rajeshbhai and Hussain, Ahsan and Jesani, Krunal and Shrestha, Usha and Mittal, Yash and Kochnev, Roman and Kadam, Pritam and Ikram, Mohsin and Moradiya, Harsh Rameshbhai and Arslanian, Alice and Ignatov, Dmitry and Timofte, Radu},
|
|
403
|
+
booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVPRW)},
|
|
404
|
+
pages = {3291--3300},
|
|
405
|
+
year={2026}
|
|
303
406
|
}
|
|
304
407
|
```
|
|
305
408
|
|
|
@@ -4,7 +4,7 @@ build-backend = 'setuptools.build_meta'
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = 'lmur'
|
|
7
|
-
dynamic = ['version', 'dependencies']
|
|
7
|
+
dynamic = ['version', 'dependencies', 'optional-dependencies']
|
|
8
8
|
description = 'Neural Network Dataset'
|
|
9
9
|
readme = { file = 'README.md', content-type = 'text/markdown' }
|
|
10
10
|
license = { file = 'LICENSE' }
|
|
@@ -31,6 +31,12 @@ Repository = 'https://github.com/ABrain-One/nn-dataset'
|
|
|
31
31
|
version = { file = 'version' }
|
|
32
32
|
dependencies = { file = 'requirements.txt' }
|
|
33
33
|
|
|
34
|
+
[tool.setuptools.dynamic.optional-dependencies]
|
|
35
|
+
stat = { file = 'requirements-stat.txt' }
|
|
36
|
+
tflite = { file = 'requirements-tflite.txt' }
|
|
37
|
+
tflite-run = { file = 'requirements-tflite-run.txt' }
|
|
38
|
+
litert = { file = 'requirements-litert.txt' }
|
|
39
|
+
|
|
34
40
|
[tool.setuptools.packages.find]
|
|
35
41
|
where = ["."]
|
|
36
42
|
include = ["ab", "ab.*"]
|
|
@@ -43,7 +49,4 @@ include-package-data = true
|
|
|
43
49
|
|
|
44
50
|
[tool.setuptools.package-data]
|
|
45
51
|
'doc' = ['licenses/*']
|
|
46
|
-
'*' = ['requirements
|
|
47
|
-
|
|
48
|
-
[project.optional-dependencies]
|
|
49
|
-
stat = ['nn-stat']
|
|
52
|
+
'*' = ['requirements*.txt', 'LICENSE', 'version', '*.md']
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
nn-dataset==2.2.14
|
lmur-2.2.14/version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.2.14
|
lmur-2.2.8/requirements.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
nn-dataset==2.2.8
|
lmur-2.2.8/version
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
2.2.8
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|