env-ssl-wrapper 0.4.6__tar.gz → 0.4.7__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.
- {env_ssl_wrapper-0.4.6 → env_ssl_wrapper-0.4.7}/PKG-INFO +2 -2
- {env_ssl_wrapper-0.4.6 → env_ssl_wrapper-0.4.7}/README.md +1 -1
- {env_ssl_wrapper-0.4.6 → env_ssl_wrapper-0.4.7}/env_ssl_wrapper/action_chunk.py +12 -1
- {env_ssl_wrapper-0.4.6 → env_ssl_wrapper-0.4.7}/pyproject.toml +1 -1
- {env_ssl_wrapper-0.4.6 → env_ssl_wrapper-0.4.7}/.gitignore +0 -0
- {env_ssl_wrapper-0.4.6 → env_ssl_wrapper-0.4.7}/LICENSE +0 -0
- {env_ssl_wrapper-0.4.6 → env_ssl_wrapper-0.4.7}/env_ssl_wrapper/__init__.py +0 -0
- {env_ssl_wrapper-0.4.6 → env_ssl_wrapper-0.4.7}/env_ssl_wrapper/memory_trace.py +0 -0
- {env_ssl_wrapper-0.4.6 → env_ssl_wrapper-0.4.7}/env_ssl_wrapper/standardize/__init__.py +0 -0
- {env_ssl_wrapper-0.4.6 → env_ssl_wrapper-0.4.7}/env_ssl_wrapper/standardize/action_transform_wrapper.py +0 -0
- {env_ssl_wrapper-0.4.6 → env_ssl_wrapper-0.4.7}/env_ssl_wrapper/standardize/adapters.py +0 -0
- {env_ssl_wrapper-0.4.6 → env_ssl_wrapper-0.4.7}/env_ssl_wrapper/standardize/auto_batched_wrapper.py +0 -0
- {env_ssl_wrapper-0.4.6 → env_ssl_wrapper-0.4.7}/env_ssl_wrapper/standardize/done_tracker_wrapper.py +0 -0
- {env_ssl_wrapper-0.4.6 → env_ssl_wrapper-0.4.7}/env_ssl_wrapper/standardize/episode_padding_wrapper.py +0 -0
- {env_ssl_wrapper-0.4.6 → env_ssl_wrapper-0.4.7}/env_ssl_wrapper/standardize/flatten_obs_wrapper.py +0 -0
- {env_ssl_wrapper-0.4.6 → env_ssl_wrapper-0.4.7}/env_ssl_wrapper/standardize/helpers.py +0 -0
- {env_ssl_wrapper-0.4.6 → env_ssl_wrapper-0.4.7}/env_ssl_wrapper/standardize/image_wrapper.py +0 -0
- {env_ssl_wrapper-0.4.6 → env_ssl_wrapper-0.4.7}/env_ssl_wrapper/standardize/mocks.py +0 -0
- {env_ssl_wrapper-0.4.6 → env_ssl_wrapper-0.4.7}/env_ssl_wrapper/standardize/spaces.py +0 -0
- {env_ssl_wrapper-0.4.6 → env_ssl_wrapper-0.4.7}/env_ssl_wrapper/standardize/standardize_env_wrapper.py +0 -0
- {env_ssl_wrapper-0.4.6 → env_ssl_wrapper-0.4.7}/env_ssl_wrapper/standardize/standardize_wrapper.py +0 -0
- {env_ssl_wrapper-0.4.6 → env_ssl_wrapper-0.4.7}/env_ssl_wrapper/standardize/tensor_wrapper.py +0 -0
- {env_ssl_wrapper-0.4.6 → env_ssl_wrapper-0.4.7}/env_ssl_wrapper/standardize/time_limit_wrapper.py +0 -0
- {env_ssl_wrapper-0.4.6 → env_ssl_wrapper-0.4.7}/env_ssl_wrapper/standardize/utils.py +0 -0
- {env_ssl_wrapper-0.4.6 → env_ssl_wrapper-0.4.7}/env_ssl_wrapper/standardize/vector.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: env-ssl-wrapper
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.7
|
|
4
4
|
Summary: One torch-native interface for any MDP environment
|
|
5
5
|
Project-URL: Homepage, https://pypi.org/project/env-ssl-wrapper/
|
|
6
6
|
Project-URL: Repository, https://codeberg.org/lucidrains/env-ssl-wrapper
|
|
@@ -161,7 +161,7 @@ while True:
|
|
|
161
161
|
obs, info = env.reset()
|
|
162
162
|
```
|
|
163
163
|
|
|
164
|
-
Chunks are shaped `(num_envs, chunk_len, *action_shape)` (`(num_envs, chunk_len)` for discrete actions).
|
|
164
|
+
Chunks are shaped `(num_envs, chunk_len, *action_shape)` (`(num_envs, chunk_len)` for discrete actions). The wrapper can also be applied directly to raw gymnasium environments, single or vectorized — torch action chunks are converted to numpy for the underlying simulator.
|
|
165
165
|
|
|
166
166
|
Execution stops early the moment any env terminates or truncates mid-chunk — the terminal state and done flags of that substep are returned and the rest of the chunk is dropped, so a new episode is never silently advanced.
|
|
167
167
|
|
|
@@ -98,7 +98,7 @@ while True:
|
|
|
98
98
|
obs, info = env.reset()
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
-
Chunks are shaped `(num_envs, chunk_len, *action_shape)` (`(num_envs, chunk_len)` for discrete actions).
|
|
101
|
+
Chunks are shaped `(num_envs, chunk_len, *action_shape)` (`(num_envs, chunk_len)` for discrete actions). The wrapper can also be applied directly to raw gymnasium environments, single or vectorized — torch action chunks are converted to numpy for the underlying simulator.
|
|
102
102
|
|
|
103
103
|
Execution stops early the moment any env terminates or truncates mid-chunk — the terminal state and done flags of that substep are returned and the rest of the chunk is dropped, so a new episode is never silently advanced.
|
|
104
104
|
|
|
@@ -11,8 +11,10 @@ from .standardize.helpers import (
|
|
|
11
11
|
default,
|
|
12
12
|
any_true,
|
|
13
13
|
dones_of,
|
|
14
|
+
first_existing,
|
|
14
15
|
get_attr,
|
|
15
16
|
is_vectorized,
|
|
17
|
+
to_numpy,
|
|
16
18
|
)
|
|
17
19
|
|
|
18
20
|
# helpers
|
|
@@ -62,9 +64,13 @@ class ActionChunkWrapper(EnvWrapper):
|
|
|
62
64
|
self.gamma = float(gamma)
|
|
63
65
|
self.reward_mode = reward_mode
|
|
64
66
|
|
|
65
|
-
|
|
67
|
+
# vectorized gym envs expose a batched action space - the single env space defines the chunk layout
|
|
68
|
+
|
|
69
|
+
action_space = first_existing(env, 'single_action_space', 'action_space')
|
|
66
70
|
self.action_shape = tuple(get_attr(action_space, 'shape', ()) or ())
|
|
71
|
+
|
|
67
72
|
self.expects_batch = is_vectorized(env)
|
|
73
|
+
self.raw_env = not isinstance(env, EnvWrapper)
|
|
68
74
|
|
|
69
75
|
@property
|
|
70
76
|
def chunk_action_shape(self):
|
|
@@ -80,6 +86,11 @@ class ActionChunkWrapper(EnvWrapper):
|
|
|
80
86
|
if not (is_tensor(actions) or isinstance(actions, np.ndarray)):
|
|
81
87
|
actions = np.asarray(actions)
|
|
82
88
|
|
|
89
|
+
# raw simulators only understand numpy - wrapper chains from this package handle torch actions
|
|
90
|
+
|
|
91
|
+
if self.raw_env and is_tensor(actions):
|
|
92
|
+
actions = to_numpy(actions)
|
|
93
|
+
|
|
83
94
|
chunk_axis = actions.ndim - 1 - len(self.action_shape)
|
|
84
95
|
|
|
85
96
|
assert chunk_axis >= 1, (
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{env_ssl_wrapper-0.4.6 → env_ssl_wrapper-0.4.7}/env_ssl_wrapper/standardize/auto_batched_wrapper.py
RENAMED
|
File without changes
|
{env_ssl_wrapper-0.4.6 → env_ssl_wrapper-0.4.7}/env_ssl_wrapper/standardize/done_tracker_wrapper.py
RENAMED
|
File without changes
|
|
File without changes
|
{env_ssl_wrapper-0.4.6 → env_ssl_wrapper-0.4.7}/env_ssl_wrapper/standardize/flatten_obs_wrapper.py
RENAMED
|
File without changes
|
|
File without changes
|
{env_ssl_wrapper-0.4.6 → env_ssl_wrapper-0.4.7}/env_ssl_wrapper/standardize/image_wrapper.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{env_ssl_wrapper-0.4.6 → env_ssl_wrapper-0.4.7}/env_ssl_wrapper/standardize/standardize_wrapper.py
RENAMED
|
File without changes
|
{env_ssl_wrapper-0.4.6 → env_ssl_wrapper-0.4.7}/env_ssl_wrapper/standardize/tensor_wrapper.py
RENAMED
|
File without changes
|
{env_ssl_wrapper-0.4.6 → env_ssl_wrapper-0.4.7}/env_ssl_wrapper/standardize/time_limit_wrapper.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|