wavedl 1.6.2__tar.gz → 1.6.3__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.
Files changed (51) hide show
  1. {wavedl-1.6.2/src/wavedl.egg-info → wavedl-1.6.3}/PKG-INFO +3 -5
  2. {wavedl-1.6.2 → wavedl-1.6.3}/README.md +2 -4
  3. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/__init__.py +1 -1
  4. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/models/__init__.py +22 -0
  5. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/test.py +8 -0
  6. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/train.py +2 -2
  7. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/utils/data.py +36 -6
  8. {wavedl-1.6.2 → wavedl-1.6.3/src/wavedl.egg-info}/PKG-INFO +3 -5
  9. {wavedl-1.6.2 → wavedl-1.6.3}/LICENSE +0 -0
  10. {wavedl-1.6.2 → wavedl-1.6.3}/pyproject.toml +0 -0
  11. {wavedl-1.6.2 → wavedl-1.6.3}/setup.cfg +0 -0
  12. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/hpo.py +0 -0
  13. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/launcher.py +0 -0
  14. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/models/_pretrained_utils.py +0 -0
  15. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/models/_template.py +0 -0
  16. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/models/base.py +0 -0
  17. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/models/caformer.py +0 -0
  18. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/models/cnn.py +0 -0
  19. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/models/convnext.py +0 -0
  20. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/models/convnext_v2.py +0 -0
  21. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/models/densenet.py +0 -0
  22. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/models/efficientnet.py +0 -0
  23. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/models/efficientnetv2.py +0 -0
  24. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/models/efficientvit.py +0 -0
  25. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/models/fastvit.py +0 -0
  26. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/models/mamba.py +0 -0
  27. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/models/maxvit.py +0 -0
  28. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/models/mobilenetv3.py +0 -0
  29. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/models/registry.py +0 -0
  30. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/models/regnet.py +0 -0
  31. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/models/resnet.py +0 -0
  32. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/models/resnet3d.py +0 -0
  33. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/models/swin.py +0 -0
  34. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/models/tcn.py +0 -0
  35. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/models/unet.py +0 -0
  36. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/models/unireplknet.py +0 -0
  37. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/models/vit.py +0 -0
  38. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/utils/__init__.py +0 -0
  39. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/utils/config.py +0 -0
  40. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/utils/constraints.py +0 -0
  41. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/utils/cross_validation.py +0 -0
  42. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/utils/distributed.py +0 -0
  43. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/utils/losses.py +0 -0
  44. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/utils/metrics.py +0 -0
  45. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/utils/optimizers.py +0 -0
  46. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl/utils/schedulers.py +0 -0
  47. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl.egg-info/SOURCES.txt +0 -0
  48. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl.egg-info/dependency_links.txt +0 -0
  49. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl.egg-info/entry_points.txt +0 -0
  50. {wavedl-1.6.2 → wavedl-1.6.3}/src/wavedl.egg-info/requires.txt +0 -0
  51. {wavedl-1.6.2 → wavedl-1.6.3}/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.2
3
+ Version: 1.6.3
4
4
  Summary: A Scalable Deep Learning Framework for Wave-Based Inverse Problems
5
5
  Author: Ductho Le
6
6
  License: MIT
@@ -214,11 +214,11 @@ This installs everything you need: training, inference, HPO, ONNX export.
214
214
  ```bash
215
215
  git clone https://github.com/ductho-le/WaveDL.git
216
216
  cd WaveDL
217
- pip install -e .
217
+ pip install -e ".[dev]"
218
218
  ```
219
219
 
220
220
  > [!NOTE]
221
- > Python 3.11+ required. For development setup, see [CONTRIBUTING.md](.github/CONTRIBUTING.md).
221
+ > Python 3.11+ required. For contributor setup (pre-commit hooks), see [CONTRIBUTING.md](.github/CONTRIBUTING.md).
222
222
 
223
223
  ### Quick Start
224
224
 
@@ -273,8 +273,6 @@ accelerate launch --num_machines 2 --main_process_ip <ip> -m wavedl.train --mode
273
273
 
274
274
  ### Testing & Inference
275
275
 
276
- After training, use `wavedl-test` to evaluate your model on test data:
277
-
278
276
  ```bash
279
277
  # Basic inference
280
278
  wavedl-test --checkpoint <checkpoint_folder> --data_path <test_data>
@@ -166,11 +166,11 @@ This installs everything you need: training, inference, HPO, ONNX export.
166
166
  ```bash
167
167
  git clone https://github.com/ductho-le/WaveDL.git
168
168
  cd WaveDL
169
- pip install -e .
169
+ pip install -e ".[dev]"
170
170
  ```
171
171
 
172
172
  > [!NOTE]
173
- > Python 3.11+ required. For development setup, see [CONTRIBUTING.md](.github/CONTRIBUTING.md).
173
+ > Python 3.11+ required. For contributor setup (pre-commit hooks), see [CONTRIBUTING.md](.github/CONTRIBUTING.md).
174
174
 
175
175
  ### Quick Start
176
176
 
@@ -225,8 +225,6 @@ accelerate launch --num_machines 2 --main_process_ip <ip> -m wavedl.train --mode
225
225
 
226
226
  ### Testing & Inference
227
227
 
228
- After training, use `wavedl-test` to evaluate your model on test data:
229
-
230
228
  ```bash
231
229
  # Basic inference
232
230
  wavedl-test --checkpoint <checkpoint_folder> --data_path <test_data>
@@ -18,7 +18,7 @@ For inference:
18
18
  # or: python -m wavedl.test --checkpoint best_checkpoint --data_path test.npz
19
19
  """
20
20
 
21
- __version__ = "1.6.2"
21
+ __version__ = "1.6.3"
22
22
  __author__ = "Ductho Le"
23
23
  __email__ = "ductho.le@outlook.com"
24
24
 
@@ -77,6 +77,15 @@ from .unet import UNetRegression
77
77
  from .vit import ViTBase_, ViTSmall, ViTTiny
78
78
 
79
79
 
80
+ # Optional RATENet (unpublished, may be gitignored)
81
+ try:
82
+ from .ratenet import RATENet, RATENetLite, RATENetTiny, RATENetV2
83
+
84
+ _HAS_RATENET = True
85
+ except ImportError:
86
+ _HAS_RATENET = False
87
+
88
+
80
89
  # Optional timm-based models (imported conditionally)
81
90
  try:
82
91
  from .caformer import CaFormerS18, CaFormerS36, PoolFormerS12
@@ -111,6 +120,7 @@ __all__ = [
111
120
  "MC3_18",
112
121
  "MODEL_REGISTRY",
113
122
  "TCN",
123
+ # Classes (uppercase first, alphabetically)
114
124
  "BaseModel",
115
125
  "ConvNeXtBase_",
116
126
  "ConvNeXtSmall",
@@ -152,6 +162,7 @@ __all__ = [
152
162
  "VimBase",
153
163
  "VimSmall",
154
164
  "VimTiny",
165
+ # Functions (lowercase, alphabetically)
155
166
  "build_model",
156
167
  "get_model",
157
168
  "list_models",
@@ -186,3 +197,14 @@ if _HAS_TIMM_MODELS:
186
197
  "UniRepLKNetTiny",
187
198
  ]
188
199
  )
200
+
201
+ # Add RATENet models to __all__ if available (unpublished)
202
+ if _HAS_RATENET:
203
+ __all__.extend(
204
+ [
205
+ "RATENet",
206
+ "RATENetLite",
207
+ "RATENetTiny",
208
+ "RATENetV2",
209
+ ]
210
+ )
@@ -398,6 +398,14 @@ def load_checkpoint(
398
398
 
399
399
  if HAS_SAFETENSORS and weight_path.suffix == ".safetensors":
400
400
  state_dict = load_safetensors(str(weight_path))
401
+ elif weight_path.suffix == ".safetensors":
402
+ # Safetensors file exists but library not installed
403
+ raise ImportError(
404
+ f"Checkpoint uses safetensors format ({weight_path.name}) but "
405
+ f"'safetensors' package is not installed. Install it with:\n"
406
+ f" pip install safetensors\n"
407
+ f"Or convert the checkpoint to PyTorch format (model.bin)."
408
+ )
401
409
  else:
402
410
  state_dict = torch.load(weight_path, map_location="cpu", weights_only=True)
403
411
 
@@ -1266,10 +1266,10 @@ def main():
1266
1266
  os.path.join(args.output_dir, "best_model_weights.pth"),
1267
1267
  )
1268
1268
 
1269
- # Copy scaler to checkpoint for portability
1269
+ # Copy scaler to checkpoint for portability (always overwrite to stay current)
1270
1270
  scaler_src = os.path.join(args.output_dir, "scaler.pkl")
1271
1271
  scaler_dst = os.path.join(ckpt_dir, "scaler.pkl")
1272
- if os.path.exists(scaler_src) and not os.path.exists(scaler_dst):
1272
+ if os.path.exists(scaler_src):
1273
1273
  shutil.copy2(scaler_src, scaler_dst)
1274
1274
 
1275
1275
  logger.info(
@@ -984,7 +984,15 @@ def load_test_data(
984
984
  f"Available keys depend on file format. Original error: {e}"
985
985
  ) from e
986
986
 
987
- # Legitimate fallback: no explicit output_key, outputs just not present
987
+ # Also fail-fast if explicit input_key was provided but not found
988
+ # This prevents silently loading a different tensor when user mistyped key
989
+ if input_key is not None:
990
+ raise KeyError(
991
+ f"Explicit --input_key '{input_key}' not found in file. "
992
+ f"Original error: {e}"
993
+ ) from e
994
+
995
+ # Legitimate fallback: no explicit keys, outputs just not present
988
996
  if format == "npz":
989
997
  # First pass to find keys
990
998
  with np.load(path, allow_pickle=False) as probe:
@@ -1524,21 +1532,43 @@ def prepare_data(
1524
1532
 
1525
1533
  logger.info(" ✔ Cache creation complete, synchronizing ranks...")
1526
1534
  else:
1527
- # NON-MAIN RANKS: Wait for cache creation
1528
- # Log that we're waiting (helps with debugging)
1535
+ # NON-MAIN RANKS: Wait for cache creation with timeout
1536
+ # Use monotonic clock (immune to system clock changes)
1529
1537
  import time
1530
1538
 
1531
- wait_start = time.time()
1539
+ wait_start = time.monotonic()
1540
+
1541
+ # Robust env parsing with guards for invalid/non-positive values
1542
+ DEFAULT_CACHE_TIMEOUT = 3600 # 1 hour default
1543
+ try:
1544
+ env_timeout = os.environ.get("WAVEDL_CACHE_TIMEOUT", "")
1545
+ CACHE_TIMEOUT = (
1546
+ int(env_timeout) if env_timeout else DEFAULT_CACHE_TIMEOUT
1547
+ )
1548
+ if CACHE_TIMEOUT <= 0:
1549
+ CACHE_TIMEOUT = DEFAULT_CACHE_TIMEOUT
1550
+ except ValueError:
1551
+ CACHE_TIMEOUT = DEFAULT_CACHE_TIMEOUT
1552
+
1532
1553
  while not (
1533
1554
  os.path.exists(CACHE_FILE)
1534
1555
  and os.path.exists(SCALER_FILE)
1535
1556
  and os.path.exists(META_FILE)
1536
1557
  ):
1537
1558
  time.sleep(5) # Check every 5 seconds
1538
- elapsed = time.time() - wait_start
1559
+ elapsed = time.monotonic() - wait_start
1560
+
1561
+ if elapsed > CACHE_TIMEOUT:
1562
+ raise RuntimeError(
1563
+ f"[Rank {accelerator.process_index}] Timeout waiting for cache "
1564
+ f"files after {CACHE_TIMEOUT}s. Rank 0 may have failed during "
1565
+ f"cache generation. Check rank 0 logs for errors."
1566
+ )
1567
+
1539
1568
  if elapsed > 60 and int(elapsed) % 60 < 5: # Log every ~minute
1540
1569
  logger.info(
1541
- f" [Rank {accelerator.process_index}] Waiting for cache creation... ({int(elapsed)}s)"
1570
+ f" [Rank {accelerator.process_index}] Waiting for cache "
1571
+ f"creation... ({int(elapsed)}s / {CACHE_TIMEOUT}s max)"
1542
1572
  )
1543
1573
  # Small delay to ensure files are fully written
1544
1574
  time.sleep(2)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: wavedl
3
- Version: 1.6.2
3
+ Version: 1.6.3
4
4
  Summary: A Scalable Deep Learning Framework for Wave-Based Inverse Problems
5
5
  Author: Ductho Le
6
6
  License: MIT
@@ -214,11 +214,11 @@ This installs everything you need: training, inference, HPO, ONNX export.
214
214
  ```bash
215
215
  git clone https://github.com/ductho-le/WaveDL.git
216
216
  cd WaveDL
217
- pip install -e .
217
+ pip install -e ".[dev]"
218
218
  ```
219
219
 
220
220
  > [!NOTE]
221
- > Python 3.11+ required. For development setup, see [CONTRIBUTING.md](.github/CONTRIBUTING.md).
221
+ > Python 3.11+ required. For contributor setup (pre-commit hooks), see [CONTRIBUTING.md](.github/CONTRIBUTING.md).
222
222
 
223
223
  ### Quick Start
224
224
 
@@ -273,8 +273,6 @@ accelerate launch --num_machines 2 --main_process_ip <ip> -m wavedl.train --mode
273
273
 
274
274
  ### Testing & Inference
275
275
 
276
- After training, use `wavedl-test` to evaluate your model on test data:
277
-
278
276
  ```bash
279
277
  # Basic inference
280
278
  wavedl-test --checkpoint <checkpoint_folder> --data_path <test_data>
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes