unienv 0.0.1b2__tar.gz → 0.0.1b4__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.
- {unienv-0.0.1b2 → unienv-0.0.1b4}/LICENSE +1 -3
- unienv-0.0.1b4/PKG-INFO +74 -0
- unienv-0.0.1b4/README.md +49 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/pyproject.toml +9 -15
- unienv-0.0.1b4/unienv.egg-info/PKG-INFO +74 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv.egg-info/SOURCES.txt +16 -8
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv.egg-info/requires.txt +1 -7
- unienv-0.0.1b4/unienv.egg-info/top_level.txt +3 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_data/base/__init__.py +0 -1
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_data/base/common.py +111 -51
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_data/base/storage.py +12 -3
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_data/batches/__init__.py +2 -1
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_data/batches/backend_compat.py +47 -1
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_data/batches/combined_batch.py +2 -4
- {unienv-0.0.1b2/unienv_data/base → unienv-0.0.1b4/unienv_data/batches}/transformations.py +3 -2
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_data/replay_buffer/replay_buffer.py +4 -0
- unienv-0.0.1b4/unienv_data/samplers/__init__.py +2 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_data/samplers/multiprocessing_sampler.py +26 -22
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_data/samplers/step_sampler.py +9 -18
- unienv-0.0.1b4/unienv_data/storages/dict_storage.py +341 -0
- unienv-0.0.1b2/unienv_data/storages/common.py → unienv-0.0.1b4/unienv_data/storages/flattened.py +24 -5
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_data/storages/hdf5.py +333 -23
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_data/storages/pytorch.py +27 -5
- unienv-0.0.1b4/unienv_data/storages/transformation.py +189 -0
- unienv-0.0.1b4/unienv_data/transformations/image_compress.py +213 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/backends/jax.py +4 -1
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/backends/numpy.py +4 -1
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/backends/pytorch.py +4 -1
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/env_base/__init__.py +1 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/env_base/env.py +5 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/env_base/funcenv.py +32 -1
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/env_base/funcenv_wrapper.py +2 -2
- unienv-0.0.1b4/unienv_interface/env_base/vec_env.py +474 -0
- unienv-0.0.1b4/unienv_interface/func_wrapper/__init__.py +2 -0
- unienv-0.0.1b4/unienv_interface/func_wrapper/frame_stack.py +150 -0
- unienv-0.0.1b4/unienv_interface/space/space_utils/__init__.py +4 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/space/space_utils/batch_utils.py +83 -0
- unienv-0.0.1b4/unienv_interface/space/space_utils/construct_utils.py +216 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/space/space_utils/serialization_utils.py +16 -1
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/space/spaces/__init__.py +3 -1
- unienv-0.0.1b4/unienv_interface/space/spaces/batched.py +90 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/space/spaces/binary.py +0 -1
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/space/spaces/box.py +13 -24
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/space/spaces/text.py +1 -3
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/transformations/dict_transform.py +31 -5
- unienv-0.0.1b4/unienv_interface/utils/control_util.py +68 -0
- unienv-0.0.1b4/unienv_interface/utils/data_queue.py +184 -0
- unienv-0.0.1b4/unienv_interface/utils/stateclass.py +46 -0
- unienv-0.0.1b4/unienv_interface/utils/vec_util.py +15 -0
- unienv-0.0.1b4/unienv_interface/world/__init__.py +6 -0
- unienv-0.0.1b4/unienv_interface/world/combined_funcnode.py +336 -0
- unienv-0.0.1b4/unienv_interface/world/combined_node.py +232 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/world/funcnode.py +1 -1
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/world/node.py +2 -2
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/wrapper/backend_compat.py +2 -2
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/wrapper/frame_stack.py +19 -114
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/wrapper/video_record.py +11 -2
- unienv-0.0.1b2/PKG-INFO +0 -73
- unienv-0.0.1b2/README.md +0 -44
- unienv-0.0.1b2/unienv.egg-info/PKG-INFO +0 -73
- unienv-0.0.1b2/unienv.egg-info/top_level.txt +0 -6
- unienv-0.0.1b2/unienv_data/samplers/__init__.py +0 -3
- unienv-0.0.1b2/unienv_data/samplers/slice_sampler.py +0 -266
- unienv-0.0.1b2/unienv_interface/func_wrapper/__init__.py +0 -1
- unienv-0.0.1b2/unienv_interface/space/space_utils/__init__.py +0 -3
- unienv-0.0.1b2/unienv_interface/world/__init__.py +0 -4
- unienv-0.0.1b2/unienv_maniskill/__init__.py +0 -1
- unienv-0.0.1b2/unienv_maniskill/wrapper/maniskill_compat.py +0 -235
- unienv-0.0.1b2/unienv_mjxplayground/__init__.py +0 -1
- unienv-0.0.1b2/unienv_mjxplayground/wrapper/playground_compat.py +0 -256
- {unienv-0.0.1b2 → unienv-0.0.1b4}/setup.cfg +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv.egg-info/dependency_links.txt +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_data/__init__.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_data/batches/framestack_batch.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_data/batches/slicestack_batch.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_data/integrations/pytorch.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_data/replay_buffer/__init__.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_data/replay_buffer/trajectory_replay_buffer.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/__init__.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/backends/__init__.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/backends/base.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/backends/serialization.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/env_base/wrapper.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/func_wrapper/transformation.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/space/__init__.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/space/space.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/space/space_utils/flatten_utils.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/space/space_utils/gym_utils.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/space/spaces/dict.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/space/spaces/dynamic_box.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/space/spaces/graph.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/space/spaces/tuple.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/space/spaces/union.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/transformations/__init__.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/transformations/batch_and_unbatch.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/transformations/chained_transform.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/transformations/filter_dict.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/transformations/rescale.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/transformations/transformation.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/utils/seed_util.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/utils/symbol_util.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/world/funcworld.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/world/world.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/wrapper/__init__.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/wrapper/action_rescale.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/wrapper/batch_and_unbatch.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/wrapper/control_frequency_limit.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/wrapper/flatten.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/wrapper/gym_compat.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/wrapper/time_limit.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b4}/unienv_interface/wrapper/transformation.py +0 -0
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
4
|
-
Copyright (c) 2022 Farama Foundation
|
|
5
|
-
Copyright (c) 2024 Yunhao Cao
|
|
3
|
+
Copyright (c) 2025 Yunhao Cao and UniEnv Contributors
|
|
6
4
|
|
|
7
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
6
|
of this software and associated documentation files (the "Software"), to deal
|
unienv-0.0.1b4/PKG-INFO
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: unienv
|
|
3
|
+
Version: 0.0.1b4
|
|
4
|
+
Summary: Unified robot environment framework supporting multiple tensor and simulation backends
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/UniEnvOrg/UniEnv
|
|
7
|
+
Project-URL: Documentation, https://github.com/UniEnvOrg/UniEnv
|
|
8
|
+
Project-URL: Repository, https://github.com/UniEnvOrg/UniEnv
|
|
9
|
+
Project-URL: Issues, https://github.com/UniEnvOrg/UniEnv/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/UniEnvOrg/UniEnv/blob/main/CHANGELOG.md
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: numpy
|
|
15
|
+
Requires-Dist: xbarray>=0.0.1a8
|
|
16
|
+
Requires-Dist: pillow
|
|
17
|
+
Requires-Dist: cloudpickle
|
|
18
|
+
Provides-Extra: dev
|
|
19
|
+
Requires-Dist: pytest; extra == "dev"
|
|
20
|
+
Provides-Extra: gymnasium
|
|
21
|
+
Requires-Dist: gymnasium>=0.29.0; extra == "gymnasium"
|
|
22
|
+
Provides-Extra: video
|
|
23
|
+
Requires-Dist: moviepy>=2.1; extra == "video"
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# UniEnv
|
|
27
|
+
|
|
28
|
+
Framework unifying robot environments and data APIs. UniEnv provides an universal interface for robot actors, sensors, environments, and data.
|
|
29
|
+
|
|
30
|
+
## Tensor library cross-backend Support
|
|
31
|
+
|
|
32
|
+
UniEnv supports multiple tensor backends with zero-copy translation layers through the DLPack protocol, and allows you to use the same abstract compute backend interface to write custom data transformation layers, environment wrappers and other utilities. This is powered by the [XBArray](https://github.com/UniEnvOrg/XBArray) package.
|
|
33
|
+
|
|
34
|
+
## Universal Robot Environment Interface
|
|
35
|
+
|
|
36
|
+
UniEnv supports diverse simulation environments and real robots, built on top of the abstract environment / world interface. This allows you to reuse code across different sim and real robots.
|
|
37
|
+
|
|
38
|
+
## Universal Robot Data Interface
|
|
39
|
+
|
|
40
|
+
UniEnv provides a universal data interface for accessing robot data through the abstract `BatchBase` interface. We also provide a utility `ReplayBuffer` for saving data from various environments with diverse data format support, including `hdf5`, memory-mapped torch tensors, and others.
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
Install the package with pip
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install unienv
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
You can install optional dependencies such as `gymnasium` (for Gymnasium-compatible environments), `dev`, or `video` by running
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pip install unienv[gymnasium,video]
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Cite
|
|
57
|
+
|
|
58
|
+
If you use UniEnv in your research, please cite it as follows:
|
|
59
|
+
|
|
60
|
+
```bibtex
|
|
61
|
+
@software{cao_unienv,
|
|
62
|
+
author = {Cao, Yunhao AND Fang, Kuan},
|
|
63
|
+
title = {{UniEnv: Unifying Robot Environments and Data APIs}},
|
|
64
|
+
year = {2025},
|
|
65
|
+
month = oct,
|
|
66
|
+
url = {https://github.com/UniEnvOrg/UniEnv},
|
|
67
|
+
license = {MIT}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Acknowledgements
|
|
72
|
+
|
|
73
|
+
The idea of this project is inspired by [Gymnasium](https://github.com/Farama-Foundation/Gymnasium) and its predecessor [OpenAI Gym](https://github.com/openai/gym).
|
|
74
|
+
This library is impossible without the great work of DataAPIs Consortium and their work on the [Array API Standard](https://data-apis.org/array-api/latest/). The zero-copy translation layers are powered by the [DLPack](https://github.com/dmlc/dlpack) project.
|
unienv-0.0.1b4/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# UniEnv
|
|
2
|
+
|
|
3
|
+
Framework unifying robot environments and data APIs. UniEnv provides an universal interface for robot actors, sensors, environments, and data.
|
|
4
|
+
|
|
5
|
+
## Tensor library cross-backend Support
|
|
6
|
+
|
|
7
|
+
UniEnv supports multiple tensor backends with zero-copy translation layers through the DLPack protocol, and allows you to use the same abstract compute backend interface to write custom data transformation layers, environment wrappers and other utilities. This is powered by the [XBArray](https://github.com/UniEnvOrg/XBArray) package.
|
|
8
|
+
|
|
9
|
+
## Universal Robot Environment Interface
|
|
10
|
+
|
|
11
|
+
UniEnv supports diverse simulation environments and real robots, built on top of the abstract environment / world interface. This allows you to reuse code across different sim and real robots.
|
|
12
|
+
|
|
13
|
+
## Universal Robot Data Interface
|
|
14
|
+
|
|
15
|
+
UniEnv provides a universal data interface for accessing robot data through the abstract `BatchBase` interface. We also provide a utility `ReplayBuffer` for saving data from various environments with diverse data format support, including `hdf5`, memory-mapped torch tensors, and others.
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
Install the package with pip
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install unienv
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
You can install optional dependencies such as `gymnasium` (for Gymnasium-compatible environments), `dev`, or `video` by running
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install unienv[gymnasium,video]
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Cite
|
|
32
|
+
|
|
33
|
+
If you use UniEnv in your research, please cite it as follows:
|
|
34
|
+
|
|
35
|
+
```bibtex
|
|
36
|
+
@software{cao_unienv,
|
|
37
|
+
author = {Cao, Yunhao AND Fang, Kuan},
|
|
38
|
+
title = {{UniEnv: Unifying Robot Environments and Data APIs}},
|
|
39
|
+
year = {2025},
|
|
40
|
+
month = oct,
|
|
41
|
+
url = {https://github.com/UniEnvOrg/UniEnv},
|
|
42
|
+
license = {MIT}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Acknowledgements
|
|
47
|
+
|
|
48
|
+
The idea of this project is inspired by [Gymnasium](https://github.com/Farama-Foundation/Gymnasium) and its predecessor [OpenAI Gym](https://github.com/openai/gym).
|
|
49
|
+
This library is impossible without the great work of DataAPIs Consortium and their work on the [Array API Standard](https://data-apis.org/array-api/latest/). The zero-copy translation layers are powered by the [DLPack](https://github.com/dmlc/dlpack) project.
|
|
@@ -3,22 +3,15 @@ name = "unienv"
|
|
|
3
3
|
description = "Unified robot environment framework supporting multiple tensor and simulation backends"
|
|
4
4
|
readme = "README.md"
|
|
5
5
|
license = "MIT"
|
|
6
|
-
version = "0.0.
|
|
6
|
+
version = "0.0.1b4"
|
|
7
7
|
requires-python = ">= 3.10"
|
|
8
8
|
dependencies = [
|
|
9
9
|
"numpy",
|
|
10
10
|
"xbarray>=0.0.1a8",
|
|
11
11
|
"pillow",
|
|
12
|
-
"
|
|
12
|
+
"cloudpickle",
|
|
13
13
|
]
|
|
14
14
|
|
|
15
|
-
[project.urls]
|
|
16
|
-
Homepage = "https://www.quantumcookie.xyz/project/unienv/"
|
|
17
|
-
Documentation = "https://readthedocs.org"
|
|
18
|
-
Repository = "https://github.com/UniEnvOrg/UniEnvPy"
|
|
19
|
-
Issues = "https://github.com/UniEnvOrg/UniEnvPy/issues"
|
|
20
|
-
Changelog = "https://github.com/UniEnvOrg/UniEnvPy/blob/main/CHANGELOG.md"
|
|
21
|
-
|
|
22
15
|
[project.optional-dependencies]
|
|
23
16
|
dev = [
|
|
24
17
|
"pytest",
|
|
@@ -29,12 +22,13 @@ gymnasium = [
|
|
|
29
22
|
video = [
|
|
30
23
|
"moviepy>=2.1"
|
|
31
24
|
]
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
25
|
+
|
|
26
|
+
[project.urls]
|
|
27
|
+
Homepage = "https://github.com/UniEnvOrg/UniEnv"
|
|
28
|
+
Documentation = "https://github.com/UniEnvOrg/UniEnv"
|
|
29
|
+
Repository = "https://github.com/UniEnvOrg/UniEnv"
|
|
30
|
+
Issues = "https://github.com/UniEnvOrg/UniEnv/issues"
|
|
31
|
+
Changelog = "https://github.com/UniEnvOrg/UniEnv/blob/main/CHANGELOG.md"
|
|
38
32
|
|
|
39
33
|
[tool.setuptools.packages.find]
|
|
40
34
|
include = ["*"]
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: unienv
|
|
3
|
+
Version: 0.0.1b4
|
|
4
|
+
Summary: Unified robot environment framework supporting multiple tensor and simulation backends
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/UniEnvOrg/UniEnv
|
|
7
|
+
Project-URL: Documentation, https://github.com/UniEnvOrg/UniEnv
|
|
8
|
+
Project-URL: Repository, https://github.com/UniEnvOrg/UniEnv
|
|
9
|
+
Project-URL: Issues, https://github.com/UniEnvOrg/UniEnv/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/UniEnvOrg/UniEnv/blob/main/CHANGELOG.md
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: numpy
|
|
15
|
+
Requires-Dist: xbarray>=0.0.1a8
|
|
16
|
+
Requires-Dist: pillow
|
|
17
|
+
Requires-Dist: cloudpickle
|
|
18
|
+
Provides-Extra: dev
|
|
19
|
+
Requires-Dist: pytest; extra == "dev"
|
|
20
|
+
Provides-Extra: gymnasium
|
|
21
|
+
Requires-Dist: gymnasium>=0.29.0; extra == "gymnasium"
|
|
22
|
+
Provides-Extra: video
|
|
23
|
+
Requires-Dist: moviepy>=2.1; extra == "video"
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# UniEnv
|
|
27
|
+
|
|
28
|
+
Framework unifying robot environments and data APIs. UniEnv provides an universal interface for robot actors, sensors, environments, and data.
|
|
29
|
+
|
|
30
|
+
## Tensor library cross-backend Support
|
|
31
|
+
|
|
32
|
+
UniEnv supports multiple tensor backends with zero-copy translation layers through the DLPack protocol, and allows you to use the same abstract compute backend interface to write custom data transformation layers, environment wrappers and other utilities. This is powered by the [XBArray](https://github.com/UniEnvOrg/XBArray) package.
|
|
33
|
+
|
|
34
|
+
## Universal Robot Environment Interface
|
|
35
|
+
|
|
36
|
+
UniEnv supports diverse simulation environments and real robots, built on top of the abstract environment / world interface. This allows you to reuse code across different sim and real robots.
|
|
37
|
+
|
|
38
|
+
## Universal Robot Data Interface
|
|
39
|
+
|
|
40
|
+
UniEnv provides a universal data interface for accessing robot data through the abstract `BatchBase` interface. We also provide a utility `ReplayBuffer` for saving data from various environments with diverse data format support, including `hdf5`, memory-mapped torch tensors, and others.
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
Install the package with pip
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install unienv
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
You can install optional dependencies such as `gymnasium` (for Gymnasium-compatible environments), `dev`, or `video` by running
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pip install unienv[gymnasium,video]
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Cite
|
|
57
|
+
|
|
58
|
+
If you use UniEnv in your research, please cite it as follows:
|
|
59
|
+
|
|
60
|
+
```bibtex
|
|
61
|
+
@software{cao_unienv,
|
|
62
|
+
author = {Cao, Yunhao AND Fang, Kuan},
|
|
63
|
+
title = {{UniEnv: Unifying Robot Environments and Data APIs}},
|
|
64
|
+
year = {2025},
|
|
65
|
+
month = oct,
|
|
66
|
+
url = {https://github.com/UniEnvOrg/UniEnv},
|
|
67
|
+
license = {MIT}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Acknowledgements
|
|
72
|
+
|
|
73
|
+
The idea of this project is inspired by [Gymnasium](https://github.com/Farama-Foundation/Gymnasium) and its predecessor [OpenAI Gym](https://github.com/openai/gym).
|
|
74
|
+
This library is impossible without the great work of DataAPIs Consortium and their work on the [Array API Standard](https://data-apis.org/array-api/latest/). The zero-copy translation layers are powered by the [DLPack](https://github.com/dmlc/dlpack) project.
|
|
@@ -10,23 +10,25 @@ unienv_data/__init__.py
|
|
|
10
10
|
unienv_data/base/__init__.py
|
|
11
11
|
unienv_data/base/common.py
|
|
12
12
|
unienv_data/base/storage.py
|
|
13
|
-
unienv_data/base/transformations.py
|
|
14
13
|
unienv_data/batches/__init__.py
|
|
15
14
|
unienv_data/batches/backend_compat.py
|
|
16
15
|
unienv_data/batches/combined_batch.py
|
|
17
16
|
unienv_data/batches/framestack_batch.py
|
|
18
17
|
unienv_data/batches/slicestack_batch.py
|
|
18
|
+
unienv_data/batches/transformations.py
|
|
19
19
|
unienv_data/integrations/pytorch.py
|
|
20
20
|
unienv_data/replay_buffer/__init__.py
|
|
21
21
|
unienv_data/replay_buffer/replay_buffer.py
|
|
22
22
|
unienv_data/replay_buffer/trajectory_replay_buffer.py
|
|
23
23
|
unienv_data/samplers/__init__.py
|
|
24
24
|
unienv_data/samplers/multiprocessing_sampler.py
|
|
25
|
-
unienv_data/samplers/slice_sampler.py
|
|
26
25
|
unienv_data/samplers/step_sampler.py
|
|
27
|
-
unienv_data/storages/
|
|
26
|
+
unienv_data/storages/dict_storage.py
|
|
27
|
+
unienv_data/storages/flattened.py
|
|
28
28
|
unienv_data/storages/hdf5.py
|
|
29
29
|
unienv_data/storages/pytorch.py
|
|
30
|
+
unienv_data/storages/transformation.py
|
|
31
|
+
unienv_data/transformations/image_compress.py
|
|
30
32
|
unienv_interface/__init__.py
|
|
31
33
|
unienv_interface/backends/__init__.py
|
|
32
34
|
unienv_interface/backends/base.py
|
|
@@ -38,17 +40,21 @@ unienv_interface/env_base/__init__.py
|
|
|
38
40
|
unienv_interface/env_base/env.py
|
|
39
41
|
unienv_interface/env_base/funcenv.py
|
|
40
42
|
unienv_interface/env_base/funcenv_wrapper.py
|
|
43
|
+
unienv_interface/env_base/vec_env.py
|
|
41
44
|
unienv_interface/env_base/wrapper.py
|
|
42
45
|
unienv_interface/func_wrapper/__init__.py
|
|
46
|
+
unienv_interface/func_wrapper/frame_stack.py
|
|
43
47
|
unienv_interface/func_wrapper/transformation.py
|
|
44
48
|
unienv_interface/space/__init__.py
|
|
45
49
|
unienv_interface/space/space.py
|
|
46
50
|
unienv_interface/space/space_utils/__init__.py
|
|
47
51
|
unienv_interface/space/space_utils/batch_utils.py
|
|
52
|
+
unienv_interface/space/space_utils/construct_utils.py
|
|
48
53
|
unienv_interface/space/space_utils/flatten_utils.py
|
|
49
54
|
unienv_interface/space/space_utils/gym_utils.py
|
|
50
55
|
unienv_interface/space/space_utils/serialization_utils.py
|
|
51
56
|
unienv_interface/space/spaces/__init__.py
|
|
57
|
+
unienv_interface/space/spaces/batched.py
|
|
52
58
|
unienv_interface/space/spaces/binary.py
|
|
53
59
|
unienv_interface/space/spaces/box.py
|
|
54
60
|
unienv_interface/space/spaces/dict.py
|
|
@@ -64,9 +70,15 @@ unienv_interface/transformations/dict_transform.py
|
|
|
64
70
|
unienv_interface/transformations/filter_dict.py
|
|
65
71
|
unienv_interface/transformations/rescale.py
|
|
66
72
|
unienv_interface/transformations/transformation.py
|
|
73
|
+
unienv_interface/utils/control_util.py
|
|
74
|
+
unienv_interface/utils/data_queue.py
|
|
67
75
|
unienv_interface/utils/seed_util.py
|
|
76
|
+
unienv_interface/utils/stateclass.py
|
|
68
77
|
unienv_interface/utils/symbol_util.py
|
|
78
|
+
unienv_interface/utils/vec_util.py
|
|
69
79
|
unienv_interface/world/__init__.py
|
|
80
|
+
unienv_interface/world/combined_funcnode.py
|
|
81
|
+
unienv_interface/world/combined_node.py
|
|
70
82
|
unienv_interface/world/funcnode.py
|
|
71
83
|
unienv_interface/world/funcworld.py
|
|
72
84
|
unienv_interface/world/node.py
|
|
@@ -81,8 +93,4 @@ unienv_interface/wrapper/frame_stack.py
|
|
|
81
93
|
unienv_interface/wrapper/gym_compat.py
|
|
82
94
|
unienv_interface/wrapper/time_limit.py
|
|
83
95
|
unienv_interface/wrapper/transformation.py
|
|
84
|
-
unienv_interface/wrapper/video_record.py
|
|
85
|
-
unienv_maniskill/__init__.py
|
|
86
|
-
unienv_maniskill/wrapper/maniskill_compat.py
|
|
87
|
-
unienv_mjxplayground/__init__.py
|
|
88
|
-
unienv_mjxplayground/wrapper/playground_compat.py
|
|
96
|
+
unienv_interface/wrapper/video_record.py
|
|
@@ -9,26 +9,44 @@ import dataclasses
|
|
|
9
9
|
|
|
10
10
|
from unienv_interface.space.space_utils import batch_utils as space_batch_utils, flatten_utils as space_flatten_utils
|
|
11
11
|
|
|
12
|
+
__all__ = [
|
|
13
|
+
"BatchT",
|
|
14
|
+
"BatchBase",
|
|
15
|
+
"BatchSampler",
|
|
16
|
+
"IndexableType",
|
|
17
|
+
"convert_index_to_backendarray",
|
|
18
|
+
]
|
|
19
|
+
|
|
12
20
|
IndexableType = Union[int, slice, EllipsisType]
|
|
13
21
|
|
|
22
|
+
def convert_index_to_backendarray(
|
|
23
|
+
backend : ComputeBackend[BArrayType, BDeviceType, BDtypeType, BRNGType],
|
|
24
|
+
index : IndexableType,
|
|
25
|
+
length : int,
|
|
26
|
+
device : Optional[BDeviceType] = None,
|
|
27
|
+
) -> BArrayType:
|
|
28
|
+
if isinstance(index, int):
|
|
29
|
+
return backend.asarray([index], dtype=backend.default_integer_dtype, device=device)
|
|
30
|
+
elif isinstance(index, slice):
|
|
31
|
+
return backend.arange(*index.indices(length), dtype=backend.default_integer_dtype, device=device)
|
|
32
|
+
elif index is Ellipsis:
|
|
33
|
+
return backend.arange(length, dtype=backend.default_integer_dtype, device=device)
|
|
34
|
+
else:
|
|
35
|
+
raise ValueError("Index must be an integer, slice, or Ellipsis.")
|
|
36
|
+
|
|
14
37
|
BatchT = TypeVar('BatchT')
|
|
15
38
|
class BatchBase(abc.ABC, Generic[BatchT, BArrayType, BDeviceType, BDtypeType, BRNGType]):
|
|
16
|
-
backend: ComputeBackend[BArrayType, BDeviceType, BDtypeType, BRNGType]
|
|
17
|
-
device: Optional[BDeviceType] = None
|
|
18
|
-
|
|
19
39
|
# If the batch is mutable, then the data can be changed (extend_*, set_*, remove_*, etc.)
|
|
20
40
|
is_mutable: bool = True
|
|
21
41
|
|
|
22
42
|
def __init__(
|
|
23
43
|
self,
|
|
24
|
-
single_space : Space[
|
|
44
|
+
single_space : Space[BatchT, BDeviceType, BDtypeType, BRNGType],
|
|
25
45
|
single_metadata_space : Optional[DictSpace[BDeviceType, BDtypeType, BRNGType]] = None,
|
|
26
46
|
):
|
|
27
47
|
self.single_space = single_space
|
|
28
48
|
self.single_metadata_space = single_metadata_space
|
|
29
|
-
self._batched_space : Space[
|
|
30
|
-
BatchT, Any, BDeviceType, BDtypeType, BRNGType
|
|
31
|
-
] = space_batch_utils.batch_space(single_space, 1)
|
|
49
|
+
self._batched_space : Space[BatchT, BDeviceType, BDtypeType, BRNGType] = space_batch_utils.batch_space(single_space, 1)
|
|
32
50
|
if single_metadata_space is not None:
|
|
33
51
|
self._batched_metadata_space : DictSpace[
|
|
34
52
|
BDeviceType, BDtypeType, BRNGType
|
|
@@ -36,24 +54,43 @@ class BatchBase(abc.ABC, Generic[BatchT, BArrayType, BDeviceType, BDtypeType, BR
|
|
|
36
54
|
else:
|
|
37
55
|
self._batched_metadata_space = None
|
|
38
56
|
|
|
57
|
+
@property
|
|
58
|
+
def backend(self) -> ComputeBackend[BArrayType, BDeviceType, BDtypeType, BRNGType]:
|
|
59
|
+
return self.single_space.backend
|
|
60
|
+
|
|
61
|
+
@property
|
|
62
|
+
def device(self) -> Optional[BDeviceType]:
|
|
63
|
+
return self.single_space.device
|
|
64
|
+
|
|
39
65
|
@abc.abstractmethod
|
|
40
66
|
def __len__(self) -> int:
|
|
41
67
|
raise NotImplementedError
|
|
42
68
|
|
|
43
69
|
def get_flattened_at(self, idx : Union[IndexableType, BArrayType]) -> BArrayType:
|
|
44
|
-
|
|
70
|
+
unflattened_data = self.get_at(idx)
|
|
71
|
+
if isinstance(idx, int):
|
|
72
|
+
return space_flatten_utils.flatten_data(self.single_space, unflattened_data)
|
|
73
|
+
else:
|
|
74
|
+
return space_flatten_utils.flatten_data(self._batched_space, unflattened_data, start_dim=1)
|
|
45
75
|
|
|
46
|
-
@abc.abstractmethod
|
|
47
76
|
def get_flattened_at_with_metadata(
|
|
48
77
|
self, idx : Union[IndexableType, BArrayType]
|
|
49
78
|
) -> Tuple[BArrayType, Optional[Dict[str, Any]]]:
|
|
50
|
-
|
|
79
|
+
unflattened_data, metadata = self.get_at_with_metadata(idx)
|
|
80
|
+
if isinstance(idx, int):
|
|
81
|
+
return space_flatten_utils.flatten_data(self.single_space, unflattened_data), metadata
|
|
82
|
+
else:
|
|
83
|
+
return space_flatten_utils.flatten_data(self._batched_space, unflattened_data, start_dim=1), metadata
|
|
51
84
|
|
|
52
85
|
def set_flattened_at(self, idx : Union[IndexableType, BArrayType], value : BArrayType) -> None:
|
|
53
86
|
raise NotImplementedError
|
|
54
87
|
|
|
88
|
+
def append_flattened(self, value : BArrayType) -> None:
|
|
89
|
+
return self.extend_flattened(value[None])
|
|
90
|
+
|
|
55
91
|
def extend_flattened(self, value : BArrayType) -> None:
|
|
56
|
-
|
|
92
|
+
unflat_data = space_flatten_utils.unflatten_data(self._batched_space, value, start_dim=1)
|
|
93
|
+
self.extend(unflat_data)
|
|
57
94
|
|
|
58
95
|
def get_at(self, idx : Union[IndexableType, BArrayType]) -> BatchT:
|
|
59
96
|
flattened_data = self.get_flattened_at(idx)
|
|
@@ -90,55 +127,81 @@ class BatchBase(abc.ABC, Generic[BatchT, BArrayType, BDeviceType, BDtypeType, BR
|
|
|
90
127
|
def __delitem__(self, idx : Union[IndexableType, BArrayType]) -> None:
|
|
91
128
|
self.remove_at(idx)
|
|
92
129
|
|
|
130
|
+
def append(self, value : BatchT) -> None:
|
|
131
|
+
batched_data = space_batch_utils.concatenate(self._batched_space, [value])
|
|
132
|
+
self.extend(batched_data)
|
|
133
|
+
|
|
93
134
|
def extend(self, value : BatchT) -> None:
|
|
94
135
|
flattened_data = space_flatten_utils.flatten_data(self._batched_space, value, start_dim=1)
|
|
95
136
|
self.extend_flattened(flattened_data)
|
|
96
137
|
|
|
138
|
+
def extend_from(
|
|
139
|
+
self,
|
|
140
|
+
other : 'BatchBase[BatchT, BArrayType, BDeviceType, BDtypeType, BRNGType]',
|
|
141
|
+
chunk_size : int = 8,
|
|
142
|
+
tqdm : bool = False,
|
|
143
|
+
) -> None:
|
|
144
|
+
n_total = len(other)
|
|
145
|
+
iterable_start = range(0, n_total, chunk_size)
|
|
146
|
+
if tqdm:
|
|
147
|
+
from tqdm import tqdm
|
|
148
|
+
iterable_start = tqdm(iterable_start, desc="Extending Batch")
|
|
149
|
+
for start_idx in range(0, n_total, chunk_size):
|
|
150
|
+
end_idx = min(start_idx + chunk_size, n_total)
|
|
151
|
+
data_chunk = other.get_at(slice(start_idx, end_idx))
|
|
152
|
+
self.extend(data_chunk)
|
|
153
|
+
|
|
97
154
|
def close(self) -> None:
|
|
98
155
|
pass
|
|
99
156
|
|
|
100
|
-
def __del__(self) -> None:
|
|
101
|
-
self.close()
|
|
102
|
-
|
|
103
157
|
SamplerBatchT = TypeVar('SamplerBatchT')
|
|
104
158
|
SamplerArrayType = TypeVar('SamplerArrayType')
|
|
105
159
|
SamplerDeviceType = TypeVar('SamplerDeviceType')
|
|
106
160
|
SamplerDtypeType = TypeVar('SamplerDtypeType')
|
|
107
161
|
SamplerRNGType = TypeVar('SamplerRNGType')
|
|
108
|
-
class BatchSampler(
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
backend : ComputeBackend[SamplerArrayType, SamplerDeviceType, SamplerDtypeType, SamplerRNGType]
|
|
118
|
-
device : Optional[SamplerDeviceType] = None
|
|
119
|
-
|
|
162
|
+
class BatchSampler(
|
|
163
|
+
Generic[
|
|
164
|
+
SamplerBatchT, SamplerArrayType, SamplerDeviceType, SamplerDtypeType, SamplerRNGType,
|
|
165
|
+
BatchT, BArrayType, BDeviceType, BDtypeType, BRNGType,
|
|
166
|
+
],
|
|
167
|
+
BatchBase[
|
|
168
|
+
SamplerBatchT, SamplerArrayType, SamplerDeviceType, SamplerDtypeType, SamplerRNGType
|
|
169
|
+
]
|
|
170
|
+
):
|
|
120
171
|
data : BatchBase[BatchT, BArrayType, BDeviceType, BDtypeType, BRNGType]
|
|
121
172
|
|
|
122
173
|
rng : Optional[SamplerRNGType] = None
|
|
123
174
|
data_rng : Optional[BRNGType] = None
|
|
124
|
-
|
|
125
|
-
def get_flat_at(self, idx : SamplerArrayType) -> SamplerArrayType:
|
|
126
|
-
return self.get_flat_at_with_metadata(idx)[0]
|
|
127
|
-
|
|
128
|
-
@abc.abstractmethod
|
|
129
|
-
def get_flat_at_with_metadata(
|
|
130
|
-
self, idx : SamplerArrayType
|
|
131
|
-
) -> Tuple[SamplerArrayType, Optional[Dict[str, Any]]]:
|
|
132
|
-
raise NotImplementedError
|
|
133
175
|
|
|
134
|
-
|
|
135
|
-
|
|
176
|
+
is_mutable : bool = False
|
|
177
|
+
|
|
178
|
+
def __init__(
|
|
179
|
+
self,
|
|
180
|
+
single_space : Space[BatchT, BDeviceType, BDtypeType, BRNGType],
|
|
181
|
+
single_metadata_space : Optional[DictSpace[BDeviceType, BDtypeType, BRNGType]] = None,
|
|
182
|
+
batch_size : int = 1,
|
|
183
|
+
) -> None:
|
|
184
|
+
super().__init__(single_space=single_space, single_metadata_space=single_metadata_space)
|
|
185
|
+
self.batch_size = batch_size
|
|
186
|
+
self._batched_space : Space[SamplerBatchT, SamplerDeviceType, SamplerDtypeType, SamplerRNGType] = space_batch_utils.batch_space(self.single_space, batch_size)
|
|
187
|
+
self._batched_metadata_space : Optional[DictSpace[SamplerDeviceType, SamplerDtypeType, SamplerRNGType]] = space_batch_utils.batch_space(self.single_metadata_space, batch_size) if self.single_metadata_space is not None else None
|
|
188
|
+
|
|
189
|
+
def manual_seed(self, seed : int) -> None:
|
|
190
|
+
if self.rng is not None:
|
|
191
|
+
self.rng = self.backend.random.random_number_generator(seed, device=self.device)
|
|
192
|
+
if self.data_rng is not None:
|
|
193
|
+
self.data_rng = self.backend.random.random_number_generator(seed, device=self.data.device)
|
|
194
|
+
|
|
195
|
+
@property
|
|
196
|
+
def sampled_space(self) -> Space[SamplerBatchT, SamplerDeviceType, SamplerDtypeType, SamplerRNGType]:
|
|
197
|
+
return self._batched_space
|
|
136
198
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
199
|
+
@property
|
|
200
|
+
def sampled_metadata_space(self) -> Optional[DictSpace[SamplerDeviceType, SamplerDtypeType, SamplerRNGType]]:
|
|
201
|
+
return self._batched_metadata_space
|
|
202
|
+
|
|
203
|
+
def __len__(self):
|
|
204
|
+
return len(self.data)
|
|
142
205
|
|
|
143
206
|
def sample_index(self) -> SamplerArrayType:
|
|
144
207
|
new_rng, indices = self.backend.random.random_discrete_uniform( # (B, )
|
|
@@ -156,11 +219,11 @@ class BatchSampler(abc.ABC, Generic[
|
|
|
156
219
|
|
|
157
220
|
def sample_flat(self) -> SamplerArrayType:
|
|
158
221
|
idx = self.sample_index()
|
|
159
|
-
return self.
|
|
222
|
+
return self.get_flattened_at(idx)
|
|
160
223
|
|
|
161
224
|
def sample_flat_with_metadata(self) -> Tuple[SamplerArrayType, Optional[Dict[str, Any]]]:
|
|
162
225
|
idx = self.sample_index()
|
|
163
|
-
return self.
|
|
226
|
+
return self.get_flattened_at_with_metadata(idx)
|
|
164
227
|
|
|
165
228
|
def sample(self) -> SamplerBatchT:
|
|
166
229
|
idx = self.sample_index()
|
|
@@ -205,9 +268,9 @@ class BatchSampler(abc.ABC, Generic[
|
|
|
205
268
|
n_batches = len(self.data) // self.batch_size
|
|
206
269
|
num_left = len(self.data) % self.batch_size
|
|
207
270
|
for i in range(n_batches):
|
|
208
|
-
yield self.
|
|
271
|
+
yield self.get_flattened_at(idx[i*self.batch_size:(i+1)*self.batch_size])
|
|
209
272
|
if num_left > 0:
|
|
210
|
-
yield self.
|
|
273
|
+
yield self.get_flattened_at(idx[-num_left:])
|
|
211
274
|
|
|
212
275
|
def epoch_flat_iter_with_metadata(self) -> Iterator[Tuple[SamplerArrayType, Optional[Dict[str, Any]]]]:
|
|
213
276
|
if self.data_rng is not None:
|
|
@@ -217,12 +280,9 @@ class BatchSampler(abc.ABC, Generic[
|
|
|
217
280
|
n_batches = len(self.data) // self.batch_size
|
|
218
281
|
num_left = len(self.data) % self.batch_size
|
|
219
282
|
for i in range(n_batches):
|
|
220
|
-
yield self.
|
|
283
|
+
yield self.get_flattened_at_with_metadata(idx[i*self.batch_size:(i+1)*self.batch_size])
|
|
221
284
|
if num_left > 0:
|
|
222
|
-
yield self.
|
|
285
|
+
yield self.get_flattened_at_with_metadata(idx[-num_left:])
|
|
223
286
|
|
|
224
287
|
def close(self) -> None:
|
|
225
288
|
pass
|
|
226
|
-
|
|
227
|
-
def __del__(self) -> None:
|
|
228
|
-
self.close()
|
|
@@ -31,6 +31,7 @@ class SpaceStorage(abc.ABC, Generic[BatchT, BArrayType, BDeviceType, BDtypeType,
|
|
|
31
31
|
single_instance_space: Space[BatchT, BDeviceType, BDtypeType, BRNGType],
|
|
32
32
|
*,
|
|
33
33
|
capacity : Optional[int] = None,
|
|
34
|
+
read_only : bool = True,
|
|
34
35
|
**kwargs
|
|
35
36
|
) -> "SpaceStorage[BatchT, BArrayType, BDeviceType, BDtypeType, BRNGType]":
|
|
36
37
|
raise NotImplementedError
|
|
@@ -56,6 +57,17 @@ class SpaceStorage(abc.ABC, Generic[BatchT, BArrayType, BDeviceType, BDtypeType,
|
|
|
56
57
|
"""
|
|
57
58
|
cache_filename : Optional[Union[str, os.PathLike]] = None
|
|
58
59
|
|
|
60
|
+
"""
|
|
61
|
+
Can the storage instance be safely used in multiprocessing environments after creation?
|
|
62
|
+
If True, the storage can be used in multiprocessing environments.
|
|
63
|
+
"""
|
|
64
|
+
is_multiprocessing_safe : bool = False
|
|
65
|
+
|
|
66
|
+
"""
|
|
67
|
+
Is the storage mutable? If False, the storage is read-only.
|
|
68
|
+
"""
|
|
69
|
+
is_mutable : bool = True
|
|
70
|
+
|
|
59
71
|
@property
|
|
60
72
|
def backend(self) -> ComputeBackend[BArrayType, BDeviceType, BDtypeType, BRNGType]:
|
|
61
73
|
return self.single_instance_space.backend
|
|
@@ -127,6 +139,3 @@ class SpaceStorage(abc.ABC, Generic[BatchT, BArrayType, BDeviceType, BDtypeType,
|
|
|
127
139
|
|
|
128
140
|
def close(self) -> None:
|
|
129
141
|
pass
|
|
130
|
-
|
|
131
|
-
def __del__(self) -> None:
|
|
132
|
-
self.close()
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from .backend_compat import ToBackendOrDeviceBatch
|
|
2
2
|
from .combined_batch import CombinedBatch
|
|
3
3
|
from .slicestack_batch import SliceStackedBatch
|
|
4
|
-
from .framestack_batch import FrameStackedBatch
|
|
4
|
+
from .framestack_batch import FrameStackedBatch
|
|
5
|
+
from .transformations import TransformedBatch
|