Braindecode 1.5.0.dev1004__py3-none-any.whl → 1.5.0.dev1007__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33,25 +33,13 @@ huggingface_hub = _soft_import(
33
33
  HAS_HF_HUB = huggingface_hub is not False
34
34
 
35
35
 
36
- _HF_INSTALL_HINT = (
37
- "requires the `huggingface_hub` package. "
38
- "Install with: pip install 'braindecode[hub]'"
39
- )
40
-
41
-
42
- class _BaseHubMixinStub:
43
- @classmethod
44
- def from_pretrained(cls, *args, **kwargs):
45
- raise ImportError(f"{cls.__name__}.from_pretrained() {_HF_INSTALL_HINT}")
46
-
47
- def push_to_hub(self, *args, **kwargs):
48
- raise ImportError(f"{type(self).__name__}.push_to_hub() {_HF_INSTALL_HINT}")
36
+ class _BaseHubMixin:
37
+ pass
49
38
 
50
39
 
51
40
  # Define base class for hub mixin
52
- _BaseHubMixin: Type = (
53
- huggingface_hub.PyTorchModelHubMixin if HAS_HF_HUB else _BaseHubMixinStub
54
- )
41
+ if HAS_HF_HUB:
42
+ _BaseHubMixin: Type = huggingface_hub.PyTorchModelHubMixin # type: ignore
55
43
 
56
44
 
57
45
  def deprecated_args(obj, *old_new_args):
@@ -6,7 +6,6 @@
6
6
  # David Sabbagh <dav.sabbagh@gmail.com>
7
7
  # Bruno Aristimunha <b.aristimunha@gmail.com>
8
8
  # Léo Burgund <leo.burgund@gmail.com>
9
- # Sarthak Tayal <sarthaktayal2@gmail.com>
10
9
  #
11
10
  # License: BSD (3-clause)
12
11
 
@@ -218,7 +217,6 @@ def preprocess(
218
217
  offset: int = 0,
219
218
  copy_data: bool | None = None,
220
219
  parallel_kwargs: dict | None = None,
221
- max_nbytes: int | str | None = "1M",
222
220
  ):
223
221
  """Apply preprocessors to a concat dataset.
224
222
 
@@ -246,20 +244,14 @@ def preprocess(
246
244
  Additional keyword arguments forwarded to ``joblib.Parallel``.
247
245
  Defaults to None (equivalent to ``{}``).
248
246
  See https://joblib.readthedocs.io/en/stable/generated/joblib.Parallel.html for details.
249
- max_nbytes : int, str, or None
250
- Threshold (in bytes; or e.g. ``"1M"``) above which joblib memory-maps
251
- preloaded arrays as read-only when dispatching to worker processes.
252
- Effective only when ``n_jobs != 1``. Pass ``None`` to disable memory
253
- mapping when a preprocessor resizes the underlying data (for example
254
- ``filterbank``), which would otherwise fail with an ``mmap can't
255
- resize a readonly`` error. ``parallel_kwargs['max_nbytes']`` takes
256
- precedence if both are provided.
257
247
 
258
248
  Returns
259
249
  -------
260
250
  BaseConcatDataset
261
251
  Preprocessed dataset.
262
252
  """
253
+ # In case of serialization, make sure directory is available before
254
+ # preprocessing
263
255
  if save_dir is not None and not overwrite:
264
256
  _check_save_dir_empty(save_dir)
265
257
 
@@ -274,35 +266,22 @@ def preprocess(
274
266
  parallel_params.setdefault(
275
267
  "prefer", "threads" if platform.system() == "Windows" else None
276
268
  )
277
- parallel_params.setdefault("max_nbytes", max_nbytes)
278
-
279
- try:
280
- list_of_ds = Parallel(n_jobs=n_jobs, **parallel_params)(
281
- delayed(_preprocess)(
282
- ds,
283
- i + offset,
284
- preprocessors,
285
- save_dir,
286
- overwrite,
287
- copy_data=(
288
- (parallel_processing and (save_dir is None))
289
- if copy_data is None
290
- else copy_data
291
- ),
292
- )
293
- for i, ds in enumerate(concat_ds.datasets)
269
+
270
+ list_of_ds = Parallel(n_jobs=n_jobs, **parallel_params)(
271
+ delayed(_preprocess)(
272
+ ds,
273
+ i + offset,
274
+ preprocessors,
275
+ save_dir,
276
+ overwrite,
277
+ copy_data=(
278
+ (parallel_processing and (save_dir is None))
279
+ if copy_data is None
280
+ else copy_data
281
+ ),
294
282
  )
295
- except (BufferError, ValueError, OSError) as exc:
296
- msg = str(exc).lower().replace("-", "")
297
- if "mmap" in msg and "readonly" in msg:
298
- raise RuntimeError(
299
- "Parallel preprocessing failed because joblib memory-mapped "
300
- "a preloaded array that a preprocessor then attempted to "
301
- "resize (e.g. ``filterbank``). Pass ``max_nbytes=None`` to "
302
- "``preprocess`` to disable memory mapping, or supply a "
303
- "``save_dir`` so the data is reloaded with ``preload=False``."
304
- ) from exc
305
- raise
283
+ for i, ds in enumerate(concat_ds.datasets)
284
+ )
306
285
 
307
286
  if save_dir is not None: # Reload datasets and replace in concat_ds
308
287
  ids_to_load = [i + offset for i in range(len(concat_ds.datasets))]
braindecode/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "1.5.0.dev1004"
1
+ __version__ = "1.5.0.dev1007"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: braindecode
3
- Version: 1.5.0.dev1004
3
+ Version: 1.5.0.dev1007
4
4
  Summary: Deep learning software to decode EEG, ECG or MEG signals
5
5
  Author-email: Robin Tibor Schirrmeister <robintibor@gmail.com>, Bruno Aristimunha Pinto <b.aristimunha@gmail.com>, Alexandre Gramfort <agramfort@meta.com>
6
6
  Maintainer-email: Alexandre Gramfort <agramfort@meta.com>, Bruno Aristimunha Pinto <b.aristimunha@gmail.com>, Robin Tibor Schirrmeister <robintibor@gmail.com>
@@ -3,7 +3,7 @@ braindecode/classifier.py,sha256=7kC_oY_UzHEes_WWdCvEpiA1ZKxMeuLL5tIPp5rfcpg,962
3
3
  braindecode/eegneuralnet.py,sha256=xjE6aPZdCQPs29NIpy_m1GLMMC2WZ3Db0Fuh1-xE1h4,13827
4
4
  braindecode/regressor.py,sha256=KiMJpqCUPWA2k2JWk9HGYTzeoBqJ4gAKEudeUVcFZY4,9266
5
5
  braindecode/util.py,sha256=f8bNIwt-SwsHqheH_BADQxTtA9oPt3Lb7GFnoI-Huwc,14101
6
- braindecode/version.py,sha256=Jctehl91ExJ5Idkg5_Gh4V4SK7S_G6mt0SO_eABfZFs,30
6
+ braindecode/version.py,sha256=D3ZA75b03PZQ80vQOvTo6EESMVaElofg2dXgccZLJV8,30
7
7
  braindecode/augmentation/__init__.py,sha256=4xune2QUK6KHMKsAqijF7I9eeiVbP0wEoQJjCNLNcKM,1081
8
8
  braindecode/augmentation/base.py,sha256=OJ1shOljI1yTY9zh2qWxQwivlY43sfx9Q-MAyMhxtPs,7338
9
9
  braindecode/augmentation/functional.py,sha256=q2k6mAXrujYlOZUndcjZN8e8b-6oJF1gGsORAI23hyE,43998
@@ -43,7 +43,7 @@ braindecode/models/__init__.py,sha256=SwnwJ-nRF0nWq2YYvw6G4F_zMrw0QCQW2VoYE2KOpS
43
43
  braindecode/models/atcnet.py,sha256=JzLV92WYWlhQol8AqE9xeWvlnWN_uswYhVOkMnuBCXo,32231
44
44
  braindecode/models/attentionbasenet.py,sha256=k7ar7aEjANudPu7krAZsRx-ag61ugirS1Xn7qFKNfWg,30483
45
45
  braindecode/models/attn_sleep.py,sha256=F9x4spTtzfiCC1h9UYITmIDQeJW6_2CXTZktZX9R0RE,17950
46
- braindecode/models/base.py,sha256=O3pkmdqaBgLWHpWkVF7ld0A95T43RFyno7mtkyi08as,28327
46
+ braindecode/models/base.py,sha256=yGJgr0f5rD-gJZ5Msw9FzGzVO-x_re-6jOSK8Iht6x4,27923
47
47
  braindecode/models/bendr.py,sha256=RkPeHoFF0vcDBW2jMo_9oS1Pxuq3wcI4ErDeL7L8QGs,29157
48
48
  braindecode/models/biot.py,sha256=UPpT1Gv7siBCMcNDNx4DS4hgs-YlmWwU5Nmikaj9WpY,22309
49
49
  braindecode/models/brainmodule.py,sha256=idyQVTp3VBJXKF1YjMx8o1kUKrcL_E_AJsioPjcuqV8,33282
@@ -111,7 +111,7 @@ braindecode/modules/wrapper.py,sha256=3lgNjcwJ1Kre2TCUouKpEp6cidFgp6LBDDWQNLOvRQ
111
111
  braindecode/preprocessing/__init__.py,sha256=NCKhT4-_-DMBFpppEg2VguCe4x7ZW-gInWn60G6hOSs,9643
112
112
  braindecode/preprocessing/eegprep_preprocess.py,sha256=wGKKo-JvG90n7eB7Y_p-bSkf8LAyIxTU8N01qPjAYQI,59989
113
113
  braindecode/preprocessing/mne_preprocess.py,sha256=taW2H-k3yreGdItCW7ldZB8jnzxBAMxX1ykgpvj7QvI,8246
114
- braindecode/preprocessing/preprocess.py,sha256=6qm0tU5JZjCLEl125cflaDk-B54rMsN8JbUUQG6cWW0,23774
114
+ braindecode/preprocessing/preprocess.py,sha256=T-MA0frxrCb61U30F9_LoljyXD5oUHgnI3uWiggfgH8,22515
115
115
  braindecode/preprocessing/util.py,sha256=ivODABSuy-SKvPMa2U6W3uWM4cwmSg-7jSKqIRxBBw4,5925
116
116
  braindecode/preprocessing/windowers.py,sha256=NTplG_8pOUrE1R-w41vevuBK_4_RHEozy1iR3RyoNCU,48949
117
117
  braindecode/samplers/__init__.py,sha256=TLuO6gXv2WioJdX671MI_CHVSsOfbjnly1Xv9K3_WdA,452
@@ -128,9 +128,9 @@ braindecode/visualization/frequency.py,sha256=gNwkn9yIik5SUp7d9HE9J_vPVGyzNsxxCO
128
128
  braindecode/visualization/metrics.py,sha256=j01kc04P9uEkQ2g2Tt2C76yr6soIj31PAuBMflrmODg,13615
129
129
  braindecode/visualization/sanity.py,sha256=nNClauUC8dCj_KCy_1RmaPDQAqExLczfPtUeQ7k9-Q0,4812
130
130
  braindecode/visualization/topology.py,sha256=mXxUfCCUJqa_cMF4y6GC3_A-qBCcS4uTc0EzBolkytE,2274
131
- braindecode-1.5.0.dev1004.dist-info/licenses/LICENSE.txt,sha256=7rg7k6hyj8m9whQ7dpKbqnCssoOEx_Mbtqb4uSOjljE,1525
132
- braindecode-1.5.0.dev1004.dist-info/licenses/NOTICE.txt,sha256=ZFFhigxIaKgDcMjCzPyAVSFV42ztU0kLOENt_kvherw,857
133
- braindecode-1.5.0.dev1004.dist-info/METADATA,sha256=wET5lgMnARymy9-u-josg-o6vbHYlOBTknou-H8bx9U,10275
134
- braindecode-1.5.0.dev1004.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
135
- braindecode-1.5.0.dev1004.dist-info/top_level.txt,sha256=pHsWQmSy0uhIez62-HA9j0iaXKvSbUL39ifFRkFnChA,12
136
- braindecode-1.5.0.dev1004.dist-info/RECORD,,
131
+ braindecode-1.5.0.dev1007.dist-info/licenses/LICENSE.txt,sha256=7rg7k6hyj8m9whQ7dpKbqnCssoOEx_Mbtqb4uSOjljE,1525
132
+ braindecode-1.5.0.dev1007.dist-info/licenses/NOTICE.txt,sha256=ZFFhigxIaKgDcMjCzPyAVSFV42ztU0kLOENt_kvherw,857
133
+ braindecode-1.5.0.dev1007.dist-info/METADATA,sha256=fxnOI00CSFVaUb9jrwzxuNGBpOsqlvIiwIMNg1-gf2I,10275
134
+ braindecode-1.5.0.dev1007.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
135
+ braindecode-1.5.0.dev1007.dist-info/top_level.txt,sha256=pHsWQmSy0uhIez62-HA9j0iaXKvSbUL39ifFRkFnChA,12
136
+ braindecode-1.5.0.dev1007.dist-info/RECORD,,