Download test_env.py from swpark5/so101-sim-env: direct link, hf CLI and curl.
- Browser
- Download file 1.14 kB
-
https://huggingface.co/swpark5/so101-sim-env/resolve/main/test_env.py
- Command line
-
hf download hf://swpark5/so101-sim-env/test_env.py
-
curl -L -o test_env.py https://huggingface.co/swpark5/so101-sim-env/resolve/main/test_env.py
1.14 kB
| import numpy as np | |
| from env import make_env | |
| print("Testing local make_env function...") | |
| # 1. n_envs=1 (๋จ์ผ ํ๊ฒฝ) ํ ์คํธ | |
| print("Testing with n_envs=1...") | |
| env_vec_n1 = make_env(n_envs=1, use_async_envs=False) | |
| obs, info = env_vec_n1.reset() | |
| print(f" Reset OK. Observation shape (n_envs=1): {obs.shape}") | |
| assert obs.shape == (1, 12) # (n_envs, obs_shape) | |
| action = env_vec_n1.action_space.sample() | |
| obs, _, _, _, _ = env_vec_n1.step(action) | |
| print(f" Step OK. Observation shape (n_envs=1): {obs.shape}") | |
| assert obs.shape == (1, 12) | |
| env_vec_n1.close() | |
| print(" n_envs=1 Test Passed.") | |
| # 2. n_envs=2 (๋ณ๋ ฌ ํ๊ฒฝ) ํ ์คํธ | |
| print("\nTesting with n_envs=2...") | |
| env_vec_n2 = make_env(n_envs=2, use_async_envs=False) | |
| obs, info = env_vec_n2.reset() | |
| print(f" Reset OK. Observation shape (n_envs=2): {obs.shape}") | |
| assert obs.shape == (2, 12) # (n_envs, obs_shape) | |
| action = env_vec_n2.action_space.sample() | |
| obs, _, _, _, _ = env_vec_n2.step(action) | |
| print(f" Step OK. Observation shape (n_envs=2): {obs.shape}") | |
| assert obs.shape == (2, 12) | |
| env_vec_n2.close() | |
| print(" n_envs=2 Test Passed.") | |
| print("\n--- All local tests passed! ---") | |