wavedl 1.6.1__tar.gz → 1.6.2__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.
- {wavedl-1.6.1/src/wavedl.egg-info → wavedl-1.6.2}/PKG-INFO +58 -61
- {wavedl-1.6.1 → wavedl-1.6.2}/README.md +57 -60
- {wavedl-1.6.1 → wavedl-1.6.2}/pyproject.toml +2 -2
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/__init__.py +1 -1
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/hpo.py +1 -1
- wavedl-1.6.1/src/wavedl/hpc.py → wavedl-1.6.2/src/wavedl/launcher.py +135 -61
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/train.py +8 -11
- {wavedl-1.6.1 → wavedl-1.6.2/src/wavedl.egg-info}/PKG-INFO +58 -61
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl.egg-info/SOURCES.txt +1 -1
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl.egg-info/entry_points.txt +2 -2
- {wavedl-1.6.1 → wavedl-1.6.2}/LICENSE +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/setup.cfg +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/models/__init__.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/models/_pretrained_utils.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/models/_template.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/models/base.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/models/caformer.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/models/cnn.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/models/convnext.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/models/convnext_v2.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/models/densenet.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/models/efficientnet.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/models/efficientnetv2.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/models/efficientvit.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/models/fastvit.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/models/mamba.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/models/maxvit.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/models/mobilenetv3.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/models/registry.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/models/regnet.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/models/resnet.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/models/resnet3d.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/models/swin.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/models/tcn.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/models/unet.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/models/unireplknet.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/models/vit.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/test.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/utils/__init__.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/utils/config.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/utils/constraints.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/utils/cross_validation.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/utils/data.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/utils/distributed.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/utils/losses.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/utils/metrics.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/utils/optimizers.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl/utils/schedulers.py +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl.egg-info/dependency_links.txt +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl.egg-info/requires.txt +0 -0
- {wavedl-1.6.1 → wavedl-1.6.2}/src/wavedl.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: wavedl
|
|
3
|
-
Version: 1.6.
|
|
3
|
+
Version: 1.6.2
|
|
4
4
|
Summary: A Scalable Deep Learning Framework for Wave-Based Inverse Problems
|
|
5
5
|
Author: Ductho Le
|
|
6
6
|
License: MIT
|
|
@@ -225,66 +225,74 @@ pip install -e .
|
|
|
225
225
|
> [!TIP]
|
|
226
226
|
> In all examples below, replace `<...>` placeholders with your values. See [Configuration](#️-configuration) for defaults and options.
|
|
227
227
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
The `wavedl-hpc` command automatically configures the environment for HPC systems:
|
|
228
|
+
### Training
|
|
231
229
|
|
|
232
230
|
```bash
|
|
233
|
-
# Basic training (auto-detects
|
|
234
|
-
wavedl-
|
|
231
|
+
# Basic training (auto-detects GPUs and environment)
|
|
232
|
+
wavedl-train --model <model_name> --data_path <train_data> --output_dir <output_folder>
|
|
235
233
|
|
|
236
234
|
# Detailed configuration
|
|
237
|
-
wavedl-
|
|
235
|
+
wavedl-train --model <model_name> --data_path <train_data> --batch_size <number> \
|
|
238
236
|
--lr <number> --epochs <number> --patience <number> --compile --output_dir <output_folder>
|
|
239
237
|
|
|
240
|
-
#
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
#### Option 2: Direct Accelerate Launch
|
|
245
|
-
|
|
246
|
-
```bash
|
|
247
|
-
# Local - auto-detects GPUs
|
|
248
|
-
accelerate launch -m wavedl.train --model <model_name> --data_path <train_data> --batch_size <number> --output_dir <output_folder>
|
|
238
|
+
# Multi-GPU is automatic (uses all available GPUs)
|
|
239
|
+
# Override with --num_gpus if needed
|
|
240
|
+
wavedl-train --model cnn --data_path train.npz --num_gpus 4 --output_dir results
|
|
249
241
|
|
|
250
242
|
# Resume training (automatic - just re-run with same output_dir)
|
|
251
|
-
|
|
252
|
-
accelerate launch -m wavedl.train --model <model_name> --data_path <train_data> --resume <checkpoint_folder> --output_dir <output_folder>
|
|
243
|
+
wavedl-train --model <model_name> --data_path <train_data> --output_dir <output_folder>
|
|
253
244
|
|
|
254
245
|
# Force fresh start (ignores existing checkpoints)
|
|
255
|
-
|
|
246
|
+
wavedl-train --model <model_name> --data_path <train_data> --output_dir <output_folder> --fresh
|
|
256
247
|
|
|
257
248
|
# List available models
|
|
258
249
|
wavedl-train --list_models
|
|
259
250
|
```
|
|
260
251
|
|
|
261
|
-
> [!
|
|
262
|
-
>
|
|
252
|
+
> [!NOTE]
|
|
253
|
+
> `wavedl-train` automatically detects your environment:
|
|
254
|
+
> - **HPC clusters** (SLURM, PBS, etc.): Uses local caching, offline WandB
|
|
255
|
+
> - **Local machines**: Uses standard cache locations (~/.cache)
|
|
263
256
|
>
|
|
264
|
-
> **
|
|
257
|
+
> **Auto-Resume**: If training crashes or is interrupted, simply re-run with the same `--output_dir`. The framework automatically detects incomplete training and resumes from the last checkpoint.
|
|
258
|
+
|
|
259
|
+
<details>
|
|
260
|
+
<summary><b>Advanced: Direct Accelerate Launch</b></summary>
|
|
261
|
+
|
|
262
|
+
For fine-grained control over distributed training, you can use `accelerate launch` directly:
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
# Custom accelerate configuration
|
|
266
|
+
accelerate launch -m wavedl.train --model <model_name> --data_path <train_data> --output_dir <output_folder>
|
|
267
|
+
|
|
268
|
+
# Multi-node training
|
|
269
|
+
accelerate launch --num_machines 2 --main_process_ip <ip> -m wavedl.train --model cnn --data_path train.npz
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
</details>
|
|
265
273
|
|
|
266
274
|
### Testing & Inference
|
|
267
275
|
|
|
268
|
-
After training, use `wavedl
|
|
276
|
+
After training, use `wavedl-test` to evaluate your model on test data:
|
|
269
277
|
|
|
270
278
|
```bash
|
|
271
279
|
# Basic inference
|
|
272
|
-
|
|
280
|
+
wavedl-test --checkpoint <checkpoint_folder> --data_path <test_data>
|
|
273
281
|
|
|
274
282
|
# With visualization, CSV export, and multiple file formats
|
|
275
|
-
|
|
283
|
+
wavedl-test --checkpoint <checkpoint_folder> --data_path <test_data> \
|
|
276
284
|
--plot --plot_format png pdf --save_predictions --output_dir <output_folder>
|
|
277
285
|
|
|
278
286
|
# With custom parameter names
|
|
279
|
-
|
|
287
|
+
wavedl-test --checkpoint <checkpoint_folder> --data_path <test_data> \
|
|
280
288
|
--param_names '$p_1$' '$p_2$' '$p_3$' --plot
|
|
281
289
|
|
|
282
290
|
# Export model to ONNX for deployment (LabVIEW, MATLAB, C++, etc.)
|
|
283
|
-
|
|
291
|
+
wavedl-test --checkpoint <checkpoint_folder> --data_path <test_data> \
|
|
284
292
|
--export onnx --export_path <output_file.onnx>
|
|
285
293
|
|
|
286
294
|
# For 3D volumes with small depth (e.g., 8×128×128), override auto-detection
|
|
287
|
-
|
|
295
|
+
wavedl-test --checkpoint <checkpoint_folder> --data_path <test_data> \
|
|
288
296
|
--input_channels 1
|
|
289
297
|
```
|
|
290
298
|
|
|
@@ -295,7 +303,7 @@ python -m wavedl.test --checkpoint <checkpoint_folder> --data_path <test_data> \
|
|
|
295
303
|
- **Format** (with `--plot_format`): Supported formats: `png` (default), `pdf` (vector), `svg` (vector), `eps` (LaTeX), `tiff`, `jpg`, `ps`
|
|
296
304
|
|
|
297
305
|
> [!NOTE]
|
|
298
|
-
> `wavedl
|
|
306
|
+
> `wavedl-test` auto-detects the model architecture from checkpoint metadata. If unavailable, it falls back to folder name parsing. Use `--model` to override if needed.
|
|
299
307
|
|
|
300
308
|
### Adding Custom Models
|
|
301
309
|
|
|
@@ -339,7 +347,7 @@ class MyModel(BaseModel):
|
|
|
339
347
|
**Step 2: Train**
|
|
340
348
|
|
|
341
349
|
```bash
|
|
342
|
-
wavedl-
|
|
350
|
+
wavedl-train --import my_model.py --model my_model --data_path train.npz
|
|
343
351
|
```
|
|
344
352
|
|
|
345
353
|
WaveDL handles everything else: training loop, logging, checkpoints, multi-GPU, early stopping, etc.
|
|
@@ -355,10 +363,10 @@ WaveDL/
|
|
|
355
363
|
├── src/
|
|
356
364
|
│ └── wavedl/ # Main package (namespaced)
|
|
357
365
|
│ ├── __init__.py # Package init with __version__
|
|
358
|
-
│ ├── train.py # Training
|
|
366
|
+
│ ├── train.py # Training script
|
|
359
367
|
│ ├── test.py # Testing & inference script
|
|
360
368
|
│ ├── hpo.py # Hyperparameter optimization
|
|
361
|
-
│ ├──
|
|
369
|
+
│ ├── launcher.py # Training launcher (wavedl-train)
|
|
362
370
|
│ │
|
|
363
371
|
│ ├── models/ # Model Zoo (69 architectures)
|
|
364
372
|
│ │ ├── registry.py # Model factory (@register_model)
|
|
@@ -389,16 +397,7 @@ WaveDL/
|
|
|
389
397
|
## ⚙️ Configuration
|
|
390
398
|
|
|
391
399
|
> [!NOTE]
|
|
392
|
-
> All configuration options below work with
|
|
393
|
-
>
|
|
394
|
-
> **Examples:**
|
|
395
|
-
> ```bash
|
|
396
|
-
> # Using wavedl-hpc
|
|
397
|
-
> wavedl-hpc --model cnn --batch_size 256 --lr 5e-4 --compile
|
|
398
|
-
>
|
|
399
|
-
> # Using accelerate launch directly
|
|
400
|
-
> accelerate launch -m wavedl.train --model cnn --batch_size 256 --lr 5e-4 --compile
|
|
401
|
-
> ```
|
|
400
|
+
> All configuration options below work with `wavedl-train`. The wrapper script passes all arguments directly to `train.py`.
|
|
402
401
|
|
|
403
402
|
<details>
|
|
404
403
|
<summary><b>Available Models</b> — 69 architectures</summary>
|
|
@@ -642,7 +641,7 @@ WaveDL automatically enables performance optimizations for modern GPUs:
|
|
|
642
641
|
</details>
|
|
643
642
|
|
|
644
643
|
<details>
|
|
645
|
-
<summary><b>
|
|
644
|
+
<summary><b>Distributed Training Arguments</b></summary>
|
|
646
645
|
|
|
647
646
|
| Argument | Default | Description |
|
|
648
647
|
|----------|---------|-------------|
|
|
@@ -674,10 +673,10 @@ WaveDL automatically enables performance optimizations for modern GPUs:
|
|
|
674
673
|
**Example:**
|
|
675
674
|
```bash
|
|
676
675
|
# Use Huber loss for noisy NDE data
|
|
677
|
-
|
|
676
|
+
wavedl-train --model cnn --loss huber --huber_delta 0.5
|
|
678
677
|
|
|
679
678
|
# Weighted MSE: prioritize thickness (first target)
|
|
680
|
-
|
|
679
|
+
wavedl-train --model cnn --loss weighted_mse --loss_weights "2.0,1.0,1.0"
|
|
681
680
|
```
|
|
682
681
|
|
|
683
682
|
</details>
|
|
@@ -697,10 +696,10 @@ accelerate launch -m wavedl.train --model cnn --loss weighted_mse --loss_weights
|
|
|
697
696
|
**Example:**
|
|
698
697
|
```bash
|
|
699
698
|
# SGD with Nesterov momentum (often better generalization)
|
|
700
|
-
|
|
699
|
+
wavedl-train --model cnn --optimizer sgd --lr 0.01 --momentum 0.9 --nesterov
|
|
701
700
|
|
|
702
701
|
# RAdam for more stable training
|
|
703
|
-
|
|
702
|
+
wavedl-train --model cnn --optimizer radam --lr 1e-3
|
|
704
703
|
```
|
|
705
704
|
|
|
706
705
|
</details>
|
|
@@ -722,13 +721,13 @@ accelerate launch -m wavedl.train --model cnn --optimizer radam --lr 1e-3
|
|
|
722
721
|
**Example:**
|
|
723
722
|
```bash
|
|
724
723
|
# Cosine annealing for 1000 epochs
|
|
725
|
-
|
|
724
|
+
wavedl-train --model cnn --scheduler cosine --epochs 1000 --min_lr 1e-7
|
|
726
725
|
|
|
727
726
|
# OneCycleLR for super-convergence
|
|
728
|
-
|
|
727
|
+
wavedl-train --model cnn --scheduler onecycle --lr 1e-2 --epochs 50
|
|
729
728
|
|
|
730
729
|
# MultiStep with custom milestones
|
|
731
|
-
|
|
730
|
+
wavedl-train --model cnn --scheduler multistep --milestones "100,200,300"
|
|
732
731
|
```
|
|
733
732
|
|
|
734
733
|
</details>
|
|
@@ -739,16 +738,14 @@ accelerate launch -m wavedl.train --model cnn --scheduler multistep --milestones
|
|
|
739
738
|
For robust model evaluation, simply add the `--cv` flag:
|
|
740
739
|
|
|
741
740
|
```bash
|
|
742
|
-
# 5-fold cross-validation
|
|
743
|
-
wavedl-
|
|
744
|
-
# OR
|
|
745
|
-
accelerate launch -m wavedl.train --model cnn --cv 5 --data_path train_data.npz
|
|
741
|
+
# 5-fold cross-validation
|
|
742
|
+
wavedl-train --model cnn --cv 5 --data_path train_data.npz
|
|
746
743
|
|
|
747
744
|
# Stratified CV (recommended for unbalanced data)
|
|
748
|
-
wavedl-
|
|
745
|
+
wavedl-train --model cnn --cv 5 --cv_stratify --loss huber --epochs 100
|
|
749
746
|
|
|
750
747
|
# Full configuration
|
|
751
|
-
wavedl-
|
|
748
|
+
wavedl-train --model cnn --cv 5 --cv_stratify \
|
|
752
749
|
--loss huber --optimizer adamw --scheduler cosine \
|
|
753
750
|
--output_dir ./cv_results
|
|
754
751
|
```
|
|
@@ -773,10 +770,10 @@ Use YAML files for reproducible experiments. CLI arguments can override any conf
|
|
|
773
770
|
|
|
774
771
|
```bash
|
|
775
772
|
# Use a config file
|
|
776
|
-
|
|
773
|
+
wavedl-train --config configs/config.yaml --data_path train.npz
|
|
777
774
|
|
|
778
775
|
# Override specific values from config
|
|
779
|
-
|
|
776
|
+
wavedl-train --config configs/config.yaml --lr 5e-4 --epochs 500
|
|
780
777
|
```
|
|
781
778
|
|
|
782
779
|
**Example config (`configs/config.yaml`):**
|
|
@@ -929,7 +926,7 @@ wavedl-hpo --data_path train.npz --models cnn --n_trials 50 --quick
|
|
|
929
926
|
|
|
930
927
|
After HPO completes, it prints the optimal command:
|
|
931
928
|
```bash
|
|
932
|
-
|
|
929
|
+
wavedl-train --data_path train.npz --model cnn --lr 3.2e-4 --batch_size 128 ...
|
|
933
930
|
```
|
|
934
931
|
|
|
935
932
|
---
|
|
@@ -1122,12 +1119,12 @@ The `examples/` folder contains a **complete, ready-to-run example** for **mater
|
|
|
1122
1119
|
|
|
1123
1120
|
```bash
|
|
1124
1121
|
# Run inference on the example data
|
|
1125
|
-
|
|
1122
|
+
wavedl-test --checkpoint ./examples/elasticity_prediction/best_checkpoint \
|
|
1126
1123
|
--data_path ./examples/elasticity_prediction/Test_data_100.mat \
|
|
1127
1124
|
--plot --save_predictions --output_dir ./examples/elasticity_prediction/test_results
|
|
1128
1125
|
|
|
1129
1126
|
# Export to ONNX (already included as model.onnx)
|
|
1130
|
-
|
|
1127
|
+
wavedl-test --checkpoint ./examples/elasticity_prediction/best_checkpoint \
|
|
1131
1128
|
--data_path ./examples/elasticity_prediction/Test_data_100.mat \
|
|
1132
1129
|
--export onnx --export_path ./examples/elasticity_prediction/model.onnx
|
|
1133
1130
|
```
|
|
@@ -177,66 +177,74 @@ pip install -e .
|
|
|
177
177
|
> [!TIP]
|
|
178
178
|
> In all examples below, replace `<...>` placeholders with your values. See [Configuration](#️-configuration) for defaults and options.
|
|
179
179
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
The `wavedl-hpc` command automatically configures the environment for HPC systems:
|
|
180
|
+
### Training
|
|
183
181
|
|
|
184
182
|
```bash
|
|
185
|
-
# Basic training (auto-detects
|
|
186
|
-
wavedl-
|
|
183
|
+
# Basic training (auto-detects GPUs and environment)
|
|
184
|
+
wavedl-train --model <model_name> --data_path <train_data> --output_dir <output_folder>
|
|
187
185
|
|
|
188
186
|
# Detailed configuration
|
|
189
|
-
wavedl-
|
|
187
|
+
wavedl-train --model <model_name> --data_path <train_data> --batch_size <number> \
|
|
190
188
|
--lr <number> --epochs <number> --patience <number> --compile --output_dir <output_folder>
|
|
191
189
|
|
|
192
|
-
#
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
#### Option 2: Direct Accelerate Launch
|
|
197
|
-
|
|
198
|
-
```bash
|
|
199
|
-
# Local - auto-detects GPUs
|
|
200
|
-
accelerate launch -m wavedl.train --model <model_name> --data_path <train_data> --batch_size <number> --output_dir <output_folder>
|
|
190
|
+
# Multi-GPU is automatic (uses all available GPUs)
|
|
191
|
+
# Override with --num_gpus if needed
|
|
192
|
+
wavedl-train --model cnn --data_path train.npz --num_gpus 4 --output_dir results
|
|
201
193
|
|
|
202
194
|
# Resume training (automatic - just re-run with same output_dir)
|
|
203
|
-
|
|
204
|
-
accelerate launch -m wavedl.train --model <model_name> --data_path <train_data> --resume <checkpoint_folder> --output_dir <output_folder>
|
|
195
|
+
wavedl-train --model <model_name> --data_path <train_data> --output_dir <output_folder>
|
|
205
196
|
|
|
206
197
|
# Force fresh start (ignores existing checkpoints)
|
|
207
|
-
|
|
198
|
+
wavedl-train --model <model_name> --data_path <train_data> --output_dir <output_folder> --fresh
|
|
208
199
|
|
|
209
200
|
# List available models
|
|
210
201
|
wavedl-train --list_models
|
|
211
202
|
```
|
|
212
203
|
|
|
213
|
-
> [!
|
|
214
|
-
>
|
|
204
|
+
> [!NOTE]
|
|
205
|
+
> `wavedl-train` automatically detects your environment:
|
|
206
|
+
> - **HPC clusters** (SLURM, PBS, etc.): Uses local caching, offline WandB
|
|
207
|
+
> - **Local machines**: Uses standard cache locations (~/.cache)
|
|
215
208
|
>
|
|
216
|
-
> **
|
|
209
|
+
> **Auto-Resume**: If training crashes or is interrupted, simply re-run with the same `--output_dir`. The framework automatically detects incomplete training and resumes from the last checkpoint.
|
|
210
|
+
|
|
211
|
+
<details>
|
|
212
|
+
<summary><b>Advanced: Direct Accelerate Launch</b></summary>
|
|
213
|
+
|
|
214
|
+
For fine-grained control over distributed training, you can use `accelerate launch` directly:
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
# Custom accelerate configuration
|
|
218
|
+
accelerate launch -m wavedl.train --model <model_name> --data_path <train_data> --output_dir <output_folder>
|
|
219
|
+
|
|
220
|
+
# Multi-node training
|
|
221
|
+
accelerate launch --num_machines 2 --main_process_ip <ip> -m wavedl.train --model cnn --data_path train.npz
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
</details>
|
|
217
225
|
|
|
218
226
|
### Testing & Inference
|
|
219
227
|
|
|
220
|
-
After training, use `wavedl
|
|
228
|
+
After training, use `wavedl-test` to evaluate your model on test data:
|
|
221
229
|
|
|
222
230
|
```bash
|
|
223
231
|
# Basic inference
|
|
224
|
-
|
|
232
|
+
wavedl-test --checkpoint <checkpoint_folder> --data_path <test_data>
|
|
225
233
|
|
|
226
234
|
# With visualization, CSV export, and multiple file formats
|
|
227
|
-
|
|
235
|
+
wavedl-test --checkpoint <checkpoint_folder> --data_path <test_data> \
|
|
228
236
|
--plot --plot_format png pdf --save_predictions --output_dir <output_folder>
|
|
229
237
|
|
|
230
238
|
# With custom parameter names
|
|
231
|
-
|
|
239
|
+
wavedl-test --checkpoint <checkpoint_folder> --data_path <test_data> \
|
|
232
240
|
--param_names '$p_1$' '$p_2$' '$p_3$' --plot
|
|
233
241
|
|
|
234
242
|
# Export model to ONNX for deployment (LabVIEW, MATLAB, C++, etc.)
|
|
235
|
-
|
|
243
|
+
wavedl-test --checkpoint <checkpoint_folder> --data_path <test_data> \
|
|
236
244
|
--export onnx --export_path <output_file.onnx>
|
|
237
245
|
|
|
238
246
|
# For 3D volumes with small depth (e.g., 8×128×128), override auto-detection
|
|
239
|
-
|
|
247
|
+
wavedl-test --checkpoint <checkpoint_folder> --data_path <test_data> \
|
|
240
248
|
--input_channels 1
|
|
241
249
|
```
|
|
242
250
|
|
|
@@ -247,7 +255,7 @@ python -m wavedl.test --checkpoint <checkpoint_folder> --data_path <test_data> \
|
|
|
247
255
|
- **Format** (with `--plot_format`): Supported formats: `png` (default), `pdf` (vector), `svg` (vector), `eps` (LaTeX), `tiff`, `jpg`, `ps`
|
|
248
256
|
|
|
249
257
|
> [!NOTE]
|
|
250
|
-
> `wavedl
|
|
258
|
+
> `wavedl-test` auto-detects the model architecture from checkpoint metadata. If unavailable, it falls back to folder name parsing. Use `--model` to override if needed.
|
|
251
259
|
|
|
252
260
|
### Adding Custom Models
|
|
253
261
|
|
|
@@ -291,7 +299,7 @@ class MyModel(BaseModel):
|
|
|
291
299
|
**Step 2: Train**
|
|
292
300
|
|
|
293
301
|
```bash
|
|
294
|
-
wavedl-
|
|
302
|
+
wavedl-train --import my_model.py --model my_model --data_path train.npz
|
|
295
303
|
```
|
|
296
304
|
|
|
297
305
|
WaveDL handles everything else: training loop, logging, checkpoints, multi-GPU, early stopping, etc.
|
|
@@ -307,10 +315,10 @@ WaveDL/
|
|
|
307
315
|
├── src/
|
|
308
316
|
│ └── wavedl/ # Main package (namespaced)
|
|
309
317
|
│ ├── __init__.py # Package init with __version__
|
|
310
|
-
│ ├── train.py # Training
|
|
318
|
+
│ ├── train.py # Training script
|
|
311
319
|
│ ├── test.py # Testing & inference script
|
|
312
320
|
│ ├── hpo.py # Hyperparameter optimization
|
|
313
|
-
│ ├──
|
|
321
|
+
│ ├── launcher.py # Training launcher (wavedl-train)
|
|
314
322
|
│ │
|
|
315
323
|
│ ├── models/ # Model Zoo (69 architectures)
|
|
316
324
|
│ │ ├── registry.py # Model factory (@register_model)
|
|
@@ -341,16 +349,7 @@ WaveDL/
|
|
|
341
349
|
## ⚙️ Configuration
|
|
342
350
|
|
|
343
351
|
> [!NOTE]
|
|
344
|
-
> All configuration options below work with
|
|
345
|
-
>
|
|
346
|
-
> **Examples:**
|
|
347
|
-
> ```bash
|
|
348
|
-
> # Using wavedl-hpc
|
|
349
|
-
> wavedl-hpc --model cnn --batch_size 256 --lr 5e-4 --compile
|
|
350
|
-
>
|
|
351
|
-
> # Using accelerate launch directly
|
|
352
|
-
> accelerate launch -m wavedl.train --model cnn --batch_size 256 --lr 5e-4 --compile
|
|
353
|
-
> ```
|
|
352
|
+
> All configuration options below work with `wavedl-train`. The wrapper script passes all arguments directly to `train.py`.
|
|
354
353
|
|
|
355
354
|
<details>
|
|
356
355
|
<summary><b>Available Models</b> — 69 architectures</summary>
|
|
@@ -594,7 +593,7 @@ WaveDL automatically enables performance optimizations for modern GPUs:
|
|
|
594
593
|
</details>
|
|
595
594
|
|
|
596
595
|
<details>
|
|
597
|
-
<summary><b>
|
|
596
|
+
<summary><b>Distributed Training Arguments</b></summary>
|
|
598
597
|
|
|
599
598
|
| Argument | Default | Description |
|
|
600
599
|
|----------|---------|-------------|
|
|
@@ -626,10 +625,10 @@ WaveDL automatically enables performance optimizations for modern GPUs:
|
|
|
626
625
|
**Example:**
|
|
627
626
|
```bash
|
|
628
627
|
# Use Huber loss for noisy NDE data
|
|
629
|
-
|
|
628
|
+
wavedl-train --model cnn --loss huber --huber_delta 0.5
|
|
630
629
|
|
|
631
630
|
# Weighted MSE: prioritize thickness (first target)
|
|
632
|
-
|
|
631
|
+
wavedl-train --model cnn --loss weighted_mse --loss_weights "2.0,1.0,1.0"
|
|
633
632
|
```
|
|
634
633
|
|
|
635
634
|
</details>
|
|
@@ -649,10 +648,10 @@ accelerate launch -m wavedl.train --model cnn --loss weighted_mse --loss_weights
|
|
|
649
648
|
**Example:**
|
|
650
649
|
```bash
|
|
651
650
|
# SGD with Nesterov momentum (often better generalization)
|
|
652
|
-
|
|
651
|
+
wavedl-train --model cnn --optimizer sgd --lr 0.01 --momentum 0.9 --nesterov
|
|
653
652
|
|
|
654
653
|
# RAdam for more stable training
|
|
655
|
-
|
|
654
|
+
wavedl-train --model cnn --optimizer radam --lr 1e-3
|
|
656
655
|
```
|
|
657
656
|
|
|
658
657
|
</details>
|
|
@@ -674,13 +673,13 @@ accelerate launch -m wavedl.train --model cnn --optimizer radam --lr 1e-3
|
|
|
674
673
|
**Example:**
|
|
675
674
|
```bash
|
|
676
675
|
# Cosine annealing for 1000 epochs
|
|
677
|
-
|
|
676
|
+
wavedl-train --model cnn --scheduler cosine --epochs 1000 --min_lr 1e-7
|
|
678
677
|
|
|
679
678
|
# OneCycleLR for super-convergence
|
|
680
|
-
|
|
679
|
+
wavedl-train --model cnn --scheduler onecycle --lr 1e-2 --epochs 50
|
|
681
680
|
|
|
682
681
|
# MultiStep with custom milestones
|
|
683
|
-
|
|
682
|
+
wavedl-train --model cnn --scheduler multistep --milestones "100,200,300"
|
|
684
683
|
```
|
|
685
684
|
|
|
686
685
|
</details>
|
|
@@ -691,16 +690,14 @@ accelerate launch -m wavedl.train --model cnn --scheduler multistep --milestones
|
|
|
691
690
|
For robust model evaluation, simply add the `--cv` flag:
|
|
692
691
|
|
|
693
692
|
```bash
|
|
694
|
-
# 5-fold cross-validation
|
|
695
|
-
wavedl-
|
|
696
|
-
# OR
|
|
697
|
-
accelerate launch -m wavedl.train --model cnn --cv 5 --data_path train_data.npz
|
|
693
|
+
# 5-fold cross-validation
|
|
694
|
+
wavedl-train --model cnn --cv 5 --data_path train_data.npz
|
|
698
695
|
|
|
699
696
|
# Stratified CV (recommended for unbalanced data)
|
|
700
|
-
wavedl-
|
|
697
|
+
wavedl-train --model cnn --cv 5 --cv_stratify --loss huber --epochs 100
|
|
701
698
|
|
|
702
699
|
# Full configuration
|
|
703
|
-
wavedl-
|
|
700
|
+
wavedl-train --model cnn --cv 5 --cv_stratify \
|
|
704
701
|
--loss huber --optimizer adamw --scheduler cosine \
|
|
705
702
|
--output_dir ./cv_results
|
|
706
703
|
```
|
|
@@ -725,10 +722,10 @@ Use YAML files for reproducible experiments. CLI arguments can override any conf
|
|
|
725
722
|
|
|
726
723
|
```bash
|
|
727
724
|
# Use a config file
|
|
728
|
-
|
|
725
|
+
wavedl-train --config configs/config.yaml --data_path train.npz
|
|
729
726
|
|
|
730
727
|
# Override specific values from config
|
|
731
|
-
|
|
728
|
+
wavedl-train --config configs/config.yaml --lr 5e-4 --epochs 500
|
|
732
729
|
```
|
|
733
730
|
|
|
734
731
|
**Example config (`configs/config.yaml`):**
|
|
@@ -881,7 +878,7 @@ wavedl-hpo --data_path train.npz --models cnn --n_trials 50 --quick
|
|
|
881
878
|
|
|
882
879
|
After HPO completes, it prints the optimal command:
|
|
883
880
|
```bash
|
|
884
|
-
|
|
881
|
+
wavedl-train --data_path train.npz --model cnn --lr 3.2e-4 --batch_size 128 ...
|
|
885
882
|
```
|
|
886
883
|
|
|
887
884
|
---
|
|
@@ -1074,12 +1071,12 @@ The `examples/` folder contains a **complete, ready-to-run example** for **mater
|
|
|
1074
1071
|
|
|
1075
1072
|
```bash
|
|
1076
1073
|
# Run inference on the example data
|
|
1077
|
-
|
|
1074
|
+
wavedl-test --checkpoint ./examples/elasticity_prediction/best_checkpoint \
|
|
1078
1075
|
--data_path ./examples/elasticity_prediction/Test_data_100.mat \
|
|
1079
1076
|
--plot --save_predictions --output_dir ./examples/elasticity_prediction/test_results
|
|
1080
1077
|
|
|
1081
1078
|
# Export to ONNX (already included as model.onnx)
|
|
1082
|
-
|
|
1079
|
+
wavedl-test --checkpoint ./examples/elasticity_prediction/best_checkpoint \
|
|
1083
1080
|
--data_path ./examples/elasticity_prediction/Test_data_100.mat \
|
|
1084
1081
|
--export onnx --export_path ./examples/elasticity_prediction/model.onnx
|
|
1085
1082
|
```
|
|
@@ -85,10 +85,10 @@ dev = [
|
|
|
85
85
|
]
|
|
86
86
|
|
|
87
87
|
[project.scripts]
|
|
88
|
-
wavedl-train = "wavedl.
|
|
88
|
+
wavedl-train = "wavedl.launcher:main" # Universal training (auto-detects HPC vs local)
|
|
89
|
+
wavedl-hpc = "wavedl.launcher:main" # Alias for backwards compatibility
|
|
89
90
|
wavedl-test = "wavedl.test:main"
|
|
90
91
|
wavedl-hpo = "wavedl.hpo:main"
|
|
91
|
-
wavedl-hpc = "wavedl.hpc:main"
|
|
92
92
|
|
|
93
93
|
[project.urls]
|
|
94
94
|
Homepage = "https://github.com/ductho-le/WaveDL"
|
|
@@ -440,7 +440,7 @@ Examples:
|
|
|
440
440
|
print("\n" + "=" * 60)
|
|
441
441
|
print("TO TRAIN WITH BEST PARAMETERS:")
|
|
442
442
|
print("=" * 60)
|
|
443
|
-
cmd_parts = ["
|
|
443
|
+
cmd_parts = ["wavedl-train"]
|
|
444
444
|
cmd_parts.append(f"--data_path {args.data_path}")
|
|
445
445
|
for key, value in study.best_params.items():
|
|
446
446
|
cmd_parts.append(f"--{key} {value}")
|