imt-ring 1.6.9__tar.gz → 1.6.11__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {imt_ring-1.6.9 → imt_ring-1.6.11}/PKG-INFO +1 -1
- {imt_ring-1.6.9 → imt_ring-1.6.11}/pyproject.toml +1 -1
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/imt_ring.egg-info/PKG-INFO +1 -1
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/algorithms/generator/base.py +44 -4
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/algorithms/generator/batch.py +7 -7
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/ml/__init__.py +3 -1
- {imt_ring-1.6.9 → imt_ring-1.6.11}/readme.md +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/setup.cfg +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/imt_ring.egg-info/SOURCES.txt +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/imt_ring.egg-info/dependency_links.txt +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/imt_ring.egg-info/requires.txt +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/imt_ring.egg-info/top_level.txt +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/__init__.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/algebra.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/algorithms/__init__.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/algorithms/_random.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/algorithms/custom_joints/__init__.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/algorithms/custom_joints/rr_imp_joint.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/algorithms/custom_joints/rr_joint.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/algorithms/custom_joints/suntay.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/algorithms/dynamics.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/algorithms/generator/__init__.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/algorithms/generator/finalize_fns.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/algorithms/generator/motion_artifacts.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/algorithms/generator/pd_control.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/algorithms/generator/setup_fns.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/algorithms/generator/types.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/algorithms/jcalc.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/algorithms/kinematics.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/algorithms/sensors.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/base.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/io/__init__.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/io/examples/branched.xml +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/io/examples/exclude/knee_trans_dof.xml +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/io/examples/exclude/standard_sys.xml +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/io/examples/exclude/standard_sys_rr_imp.xml +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/io/examples/inv_pendulum.xml +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/io/examples/knee_flexible_imus.xml +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/io/examples/spherical_stiff.xml +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/io/examples/symmetric.xml +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/io/examples/test_all_1.xml +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/io/examples/test_all_2.xml +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/io/examples/test_ang0_pos0.xml +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/io/examples/test_control.xml +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/io/examples/test_double_pendulum.xml +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/io/examples/test_free.xml +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/io/examples/test_kinematics.xml +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/io/examples/test_morph_system/four_seg_seg1.xml +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/io/examples/test_morph_system/four_seg_seg3.xml +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/io/examples/test_randomize_position.xml +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/io/examples/test_sensors.xml +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/io/examples/test_three_seg_seg2.xml +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/io/examples.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/io/test_examples.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/io/xml/__init__.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/io/xml/abstract.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/io/xml/from_xml.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/io/xml/test_from_xml.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/io/xml/test_to_xml.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/io/xml/to_xml.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/maths.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/ml/base.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/ml/callbacks.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/ml/ml_utils.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/ml/optimizer.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/ml/params/0x13e3518065c21cd8.pickle +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/ml/params/0x1d76628065a71e0f.pickle +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/ml/ringnet.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/ml/rnno_v1.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/ml/train.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/ml/training_loop.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/rendering/__init__.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/rendering/base_render.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/rendering/mujoco_render.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/rendering/vispy_render.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/rendering/vispy_visuals.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/sim2real/__init__.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/sim2real/sim2real.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/spatial.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/sys_composer/__init__.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/sys_composer/delete_sys.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/sys_composer/inject_sys.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/sys_composer/morph_sys.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/utils/__init__.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/utils/backend.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/utils/batchsize.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/utils/colab.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/utils/hdf5.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/utils/normalizer.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/utils/path.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/utils/randomize_sys.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/utils/register_gym_envs/__init__.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/utils/register_gym_envs/saddle.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/src/ring/utils/utils.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/tests/test_algebra.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/tests/test_base.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/tests/test_custom_joints.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/tests/test_dynamics.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/tests/test_generator.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/tests/test_jcalc.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/tests/test_jit.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/tests/test_kinematics.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/tests/test_maths.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/tests/test_ml_utils.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/tests/test_motion_artifacts.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/tests/test_pd_control.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/tests/test_quickstart_example.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/tests/test_random.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/tests/test_randomize.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/tests/test_rcmg.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/tests/test_render.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/tests/test_sensors.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/tests/test_sim2real.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/tests/test_sys_composer.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/tests/test_train.py +0 -0
- {imt_ring-1.6.9 → imt_ring-1.6.11}/tests/test_utils.py +0 -0
@@ -1,3 +1,4 @@
|
|
1
|
+
from functools import partial
|
1
2
|
import random
|
2
3
|
from typing import Callable, Optional
|
3
4
|
import warnings
|
@@ -6,6 +7,7 @@ import jax
|
|
6
7
|
import jax.numpy as jnp
|
7
8
|
import numpy as np
|
8
9
|
import tree_utils
|
10
|
+
from tree_utils import PyTree
|
9
11
|
|
10
12
|
from ring import base
|
11
13
|
from ring import utils
|
@@ -143,9 +145,7 @@ class RCMG:
|
|
143
145
|
|
144
146
|
return n_calls
|
145
147
|
|
146
|
-
def
|
147
|
-
self, sizes: int | list[int] = 1, seed: int = 1
|
148
|
-
) -> list[tree_utils.PyTree[np.ndarray]]:
|
148
|
+
def _generators_ncalls(self, sizes: int | list[int] = 1):
|
149
149
|
"Returns list of unbatched sequences as numpy arrays."
|
150
150
|
repeats = self._compute_repeats(sizes)
|
151
151
|
sizes = list(jnp.array(repeats) * jnp.array(self._size_of_generators))
|
@@ -165,7 +165,47 @@ class RCMG:
|
|
165
165
|
batch.generators_lazy([self.gens[i]], [reduced_repeats[i]], jits[i])
|
166
166
|
)
|
167
167
|
|
168
|
-
return
|
168
|
+
return gens, n_calls
|
169
|
+
|
170
|
+
def to_list(
|
171
|
+
self, sizes: int | list[int] = 1, seed: int = 1
|
172
|
+
) -> list[tree_utils.PyTree[np.ndarray]]:
|
173
|
+
"Returns list of unbatched sequences as numpy arrays."
|
174
|
+
gens, n_calls = self._generators_ncalls(sizes)
|
175
|
+
|
176
|
+
data = []
|
177
|
+
batch.generators_eager(
|
178
|
+
gens, n_calls, lambda d: data.extend(d), seed, self._disable_tqdm
|
179
|
+
)
|
180
|
+
return data
|
181
|
+
|
182
|
+
def to_folder(
|
183
|
+
self,
|
184
|
+
path: str,
|
185
|
+
sizes: int | list[int] = 1,
|
186
|
+
seed: int = 1,
|
187
|
+
overwrite: bool = True,
|
188
|
+
file_prefix: str = "seq",
|
189
|
+
save_fn: Callable[[PyTree[np.ndarray], str], None] = partial(
|
190
|
+
utils.pickle_save, overwrite=True
|
191
|
+
),
|
192
|
+
verbose: bool = True,
|
193
|
+
):
|
194
|
+
|
195
|
+
i = 0
|
196
|
+
|
197
|
+
def callback(data: list[PyTree[np.ndarray]]) -> None:
|
198
|
+
nonlocal i
|
199
|
+
data = utils.replace_elements_w_nans(data, verbose=verbose)
|
200
|
+
for d in data:
|
201
|
+
file = utils.parse_path(
|
202
|
+
path, file_prefix + str(i), file_exists_ok=overwrite
|
203
|
+
)
|
204
|
+
save_fn(d, file)
|
205
|
+
i += 1
|
206
|
+
|
207
|
+
gens, n_calls = self._generators_ncalls(sizes)
|
208
|
+
batch.generators_eager(gens, n_calls, callback, seed, self._disable_tqdm)
|
169
209
|
|
170
210
|
def to_pickle(
|
171
211
|
self,
|
@@ -1,8 +1,10 @@
|
|
1
|
+
from typing import Callable
|
2
|
+
|
1
3
|
import jax
|
2
4
|
import jax.numpy as jnp
|
3
5
|
import numpy as np
|
4
6
|
from tqdm import tqdm
|
5
|
-
import
|
7
|
+
from tree_utils import PyTree
|
6
8
|
|
7
9
|
from ring import utils
|
8
10
|
from ring.algorithms.generator import types
|
@@ -50,15 +52,15 @@ def generators_lazy(
|
|
50
52
|
return generator
|
51
53
|
|
52
54
|
|
53
|
-
def
|
55
|
+
def generators_eager(
|
54
56
|
generators: list[types.BatchedGenerator],
|
55
57
|
n_calls: list[int],
|
58
|
+
callback: Callable[[list[PyTree[np.ndarray]]], None],
|
56
59
|
seed: int = 1,
|
57
60
|
disable_tqdm: bool = False,
|
58
|
-
) ->
|
61
|
+
) -> None:
|
59
62
|
|
60
63
|
key = jax.random.PRNGKey(seed)
|
61
|
-
data = []
|
62
64
|
for gen, n_call in tqdm(
|
63
65
|
zip(generators, n_calls),
|
64
66
|
desc="executing generators",
|
@@ -81,6 +83,4 @@ def generators_eager_to_list(
|
|
81
83
|
|
82
84
|
sample_flat, _ = jax.tree_util.tree_flatten(sample)
|
83
85
|
size = 1 if len(sample_flat) == 0 else sample_flat[0].shape[0]
|
84
|
-
|
85
|
-
|
86
|
-
return data
|
86
|
+
callback([jax.tree_map(lambda a: a[i], sample) for i in range(size)])
|
@@ -23,6 +23,7 @@ def RNNO(
|
|
23
23
|
eval: bool = True,
|
24
24
|
samp_freq: float | None = None,
|
25
25
|
v1: bool = False,
|
26
|
+
scale_X: bool = True,
|
26
27
|
**kwargs,
|
27
28
|
):
|
28
29
|
assert "message_dim" not in kwargs
|
@@ -47,7 +48,8 @@ def RNNO(
|
|
47
48
|
**kwargs,
|
48
49
|
)
|
49
50
|
ringnet = base.NoGraph_FilterWrapper(ringnet, quat_normalize=return_quats)
|
50
|
-
|
51
|
+
if scale_X:
|
52
|
+
ringnet = base.ScaleX_FilterWrapper(ringnet)
|
51
53
|
if eval and return_quats:
|
52
54
|
ringnet = base.LPF_FilterWrapper(ringnet, _LPF_CUTOFF_FREQ, samp_freq=samp_freq)
|
53
55
|
if return_quats:
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|