imt-ring 1.6.35__py3-none-any.whl → 1.6.37__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.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: imt-ring
3
- Version: 1.6.35
3
+ Version: 1.6.37
4
4
  Summary: RING: Recurrent Inertial Graph-based Estimator
5
5
  Author-email: Simon Bachhuber <simon.bachhuber@fau.de>
6
6
  Project-URL: Homepage, https://github.com/SimiPixel/ring
@@ -59,7 +59,7 @@ ring/ml/optimizer.py,sha256=TZF0_LmnewzmGVso-zIQJtpWguUW0fW3HeRpIdG_qoI,4763
59
59
  ring/ml/ringnet.py,sha256=mef7jyN2QcApJmQGH3HYZyTV-00q8YpsYOKhW0-ku1k,8973
60
60
  ring/ml/rnno_v1.py,sha256=2qE08OIvTJ5PvSxKpYGzGSrvEImWrdAT_qslZ7jP5tA,1372
61
61
  ring/ml/train.py,sha256=Da89HxiqXC7xuX2ldpTrJStqKWN-6Vcpml4PPQuihN4,10989
62
- ring/ml/training_loop.py,sha256=CEokvPQuuk_WCd-J60ZDodJYcPVvyxLfgXDr_DnbzRI,3359
62
+ ring/ml/training_loop.py,sha256=yxuUua_4RExq_0GUYm4eUZJsBmtrwDSVL94bWUpYfdo,3586
63
63
  ring/ml/params/0x13e3518065c21cd8.pickle,sha256=Zh2k1zK-TNxJl5F7nyTeQ9001qqRE_dfvaq1HWV287A,9355838
64
64
  ring/ml/params/0x1d76628065a71e0f.pickle,sha256=YTNVuvfw-nCRD9BH1PZYcR9uCFpNWDhw8Lc50eDn_EE,9351038
65
65
  ring/rendering/__init__.py,sha256=Zf7qOdzK3t2hljIrs5P4zFhzHljLSMRyDDZO2YlZk4k,75
@@ -83,10 +83,10 @@ ring/utils/hdf5.py,sha256=BzXwVypZmEZeHVgeGZ78YYdi10NEQtnPhdrb8dQAXo0,5856
83
83
  ring/utils/normalizer.py,sha256=67L2BU1MRsMT4pD41ta3JJMppLN0ozFmnwrmXDtnqrQ,1698
84
84
  ring/utils/path.py,sha256=zRPfxYNesvgefkddd26oar6f9433LkMGkhp9dF3rPUs,1926
85
85
  ring/utils/randomize_sys.py,sha256=G_vBIo0OwQkXL2u0djwbaoaeb02C4LQCTNNloOYIU2M,3699
86
- ring/utils/utils.py,sha256=tJaWXLGOTwkxJQj2l23dX97wO3aZYhM2qd7eNuMRs84,6907
86
+ ring/utils/utils.py,sha256=gKwOXLxWraeZfX6EbBcg3hkq30DcXN0mcRUeOSTNiMo,7336
87
87
  ring/utils/register_gym_envs/__init__.py,sha256=PtPIRBQJ16339xZ9G9VpvqrvcGbQ_Pk_SUz4tQPa9nQ,94
88
88
  ring/utils/register_gym_envs/saddle.py,sha256=tA5CyW_akSXyDm0xJ83CtOrUMVElH0f9vZtEDDJQalI,4422
89
- imt_ring-1.6.35.dist-info/METADATA,sha256=mwRs6Hzb4M39Ld4PRamHOYPxtbu-Ug2kOLE03M1l8hI,4251
90
- imt_ring-1.6.35.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
91
- imt_ring-1.6.35.dist-info/top_level.txt,sha256=EiT790-lAyi8iwTzJArH3f2k77rwhDn00q-4PlmvDQo,5
92
- imt_ring-1.6.35.dist-info/RECORD,,
89
+ imt_ring-1.6.37.dist-info/METADATA,sha256=NN6c8jI6u0PjCtw3ZXs9Ktk6ODPI9igC-qyS1aUIUsI,4251
90
+ imt_ring-1.6.37.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
91
+ imt_ring-1.6.37.dist-info/top_level.txt,sha256=EiT790-lAyi8iwTzJArH3f2k77rwhDn00q-4PlmvDQo,5
92
+ imt_ring-1.6.37.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.6.0)
2
+ Generator: setuptools (75.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
ring/ml/training_loop.py CHANGED
@@ -2,11 +2,12 @@ import random
2
2
  from typing import Optional
3
3
 
4
4
  import jax
5
- from ring.algorithms import Generator
6
- from ring.ml import ml_utils
7
5
  import tqdm
8
6
  import tree_utils
9
7
 
8
+ from ring.algorithms import Generator
9
+ from ring.ml import ml_utils
10
+
10
11
  _KILL_RUN = False
11
12
 
12
13
 
@@ -83,14 +84,20 @@ class TrainingLoop:
83
84
  # reset the kill_run flag from previous runs
84
85
  send_kill_run_signal(value=False)
85
86
 
86
- for _ in tqdm.tqdm(range(n_episodes)):
87
- self.step()
88
-
89
- if recv_kill_run_signal():
90
- break
87
+ try:
88
+ for _ in tqdm.tqdm(range(n_episodes)):
89
+ self.step()
91
90
 
92
- if close_afterwards:
93
- self.close()
91
+ if recv_kill_run_signal():
92
+ break
93
+ except Exception as e:
94
+ print(
95
+ "Exception occured, attemping to .close() all callbacks before raising."
96
+ )
97
+ raise e
98
+ finally:
99
+ if close_afterwards:
100
+ self.close()
94
101
 
95
102
  return recv_kill_run_signal()
96
103
 
ring/utils/utils.py CHANGED
@@ -1,5 +1,6 @@
1
1
  from importlib import import_module as _import_module
2
2
  import io
3
+ from pathlib import Path
3
4
  import pickle
4
5
  import random
5
6
  from typing import Optional
@@ -152,13 +153,28 @@ def import_lib(
152
153
 
153
154
  def pickle_save(obj, path, overwrite: bool = False):
154
155
  path = parse_path(path, extension="pickle", file_exists_ok=overwrite)
155
- with open(path, "wb") as file:
156
- pickle.dump(obj, file, protocol=5)
156
+ try:
157
+ with open(path, "wb") as file:
158
+ pickle.dump(obj, file, protocol=5)
159
+ except OSError as e:
160
+ print(
161
+ f"saving with `pickle` throws exception {e}. "
162
+ + "Attempting to save using `joblib`"
163
+ )
164
+ path = parse_path(path, extension="joblib", file_exists_ok=overwrite)
165
+ import joblib
166
+
167
+ joblib.dump(obj, path)
157
168
 
158
169
 
159
170
  def pickle_load(
160
171
  path,
161
172
  ):
173
+ if Path(path).suffix == ".joblib":
174
+ import joblib
175
+
176
+ return joblib.load(path)
177
+
162
178
  path = parse_path(path, extension="pickle", require_is_file=True)
163
179
  with open(path, "rb") as file:
164
180
  obj = pickle.load(file)