How severe does this issue affect your experience of using Ray?
- High: It blocks me to complete my task.
Hi all,
I am getting the following error:
policy_server.py -ip=localhost -checkpoint=brawl
Traceback (most recent call last):
File "C:/Users/denys/Documents/GitHub/unity_AI/brawlhalla/policy_server.py", line 166, in <module>
ray.init(log_to_driver=False)
File "C:\Python\lib\site-packages\ray\_private\client_mode_hook.py", line 105, in wrapper
return func(*args, **kwargs)
File "C:\Python\lib\site-packages\ray\worker.py", line 1022, in init
_global_node = ray.node.Node(
File "C:\Python\lib\site-packages\ray\node.py", line 301, in __init__
self.start_ray_processes()
File "C:\Python\lib\site-packages\ray\node.py", line 1130, in start_ray_processes
resource_spec = self.get_resource_spec()
File "C:\Python\lib\site-packages\ray\node.py", line 472, in get_resource_spec
self._resource_spec = ResourceSpec(
File "C:\Python\lib\site-packages\ray\_private\resource_spec.py", line 178, in resolve
num_gpus = _autodetect_num_gpus()
File "C:\Python\lib\site-packages\ray\_private\resource_spec.py", line 295, in _autodetect_num_gpus
lines = subprocess.check_output(cmdargs).splitlines()[1:]
File "C:\Python\lib\subprocess.py", line 415, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "C:\Python\lib\subprocess.py", line 493, in run
with Popen(*popenargs, **kwargs) as process:
File "C:\Python\lib\subprocess.py", line 858, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Python\lib\subprocess.py", line 1311, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
Process finished with exit code 1
Here is my pip freeze:
absl-py==1.0.0
aiosignal==1.2.0
anyio==3.5.0
asgiref==3.5.0
astunparse==1.6.3
async-timeout==4.0.2
attrs==21.4.0
cachetools==5.0.0
certifi==2021.10.8
charset-normalizer==2.0.12
click==8.1.2
cloudpickle==1.2.2
colorama==0.4.4
cycler==0.11.0
Deprecated==1.2.13
distlib==0.3.4
dm-tree==0.1.7
fastapi==0.75.2
filelock==3.6.0
Flask==2.1.1
flatbuffers==2.0
fonttools==4.33.3
frozenlist==1.3.0
future==0.18.2
gast==0.5.3
google-auth==2.6.6
google-auth-oauthlib==0.4.6
google-pasta==0.2.0
grpcio==1.44.0
gym==0.15.3
gym-notices==0.0.6
h11==0.13.0
h5py==3.6.0
idna==3.3
imageio==2.18.0
importlib-metadata==4.11.3
importlib-resources==5.7.1
itsdangerous==2.1.2
Jinja2==3.1.1
joblib==1.1.0
jsonschema==4.4.0
keras==2.8.0
Keras-Preprocessing==1.1.2
kiwisolver==1.4.2
libclang==14.0.1
lz4==4.0.0
Markdown==3.3.6
MarkupSafe==2.1.1
matplotlib==3.5.1
mouse==0.7.1
msgpack==1.0.3
mss==6.1.0
Multi-Template-Matching==1.6.1
networkx==2.8
numpy==1.22.3
oauthlib==3.2.0
opencv-python==4.4.0.42
opencv-python-headless==4.4.0.46
opt-einsum==3.3.0
packaging==21.3
pandas==1.4.2
Pillow==9.1.0
platformdirs==2.5.2
protobuf==3.20.1
pyasn1==0.4.8
pyasn1-modules==0.2.8
pydantic==1.9.0
PyGetWindow==0.0.9
pyglet==1.3.2
pynput==1.7.6
pyparsing==3.0.8
PyRect==0.2.0
pyrsistent==0.18.1
python-dateutil==2.8.2
pytz==2022.1
PyWavelets==1.3.0
pywin32==303
PyYAML==6.0
ray==1.12.0
redis==4.2.2
requests==2.27.1
requests-oauthlib==1.3.1
rsa==4.8
scikit-image==0.17.2
scikit-learn==0.24.1
scipy==1.5.4
six==1.16.0
sniffio==1.2.0
starlette==0.17.1
tabulate==0.8.9
tensorboard==2.8.0
tensorboard-data-server==0.6.1
tensorboard-plugin-wit==1.8.1
tensorflow==2.8.0
tensorflow-io-gcs-filesystem==0.25.0
termcolor==1.1.0
tf-estimator-nightly==2.8.0.dev2021122109
threadpoolctl==3.1.0
tifffile==2022.4.26
torch==1.11.0
torchvision==0.12.0
typing-extensions==4.2.0
urllib3==1.26.9
uvicorn==0.17.6
virtualenv==20.14.1
Werkzeug==2.1.1
wrapt==1.14.0
zipp==3.8.0
Sample code to produce the issue:
from gym import spaces
import ray
from ray.rllib.agents import with_common_config
from ray.rllib.agents.ppo import PPOTrainer
from ray.rllib.env import PolicyServerInput
from ray.rllib.examples.env.random_env import RandomEnv
import numpy as np
import argparse
parser = argparse.ArgumentParser(description='Optional app description')
parser.add_argument('-ip', type=str, help='IP of this device')
parser.add_argument('-checkpoint', type=str, help='location of checkpoint to restore from')
args = parser.parse_args()
DEFAULT_CONFIG = with_common_config({
"gamma": 0.999,
# Should use a critic as a baseline (otherwise don't use value baseline;
# required for using GAE).
"use_critic": True,
# If true, use the Generalized Advantage Estimator (GAE)
# with a value function, see https://arxiv.org/pdf/1506.02438.pdf.
"use_gae": True,
# The GAE (lambda) parameter.
"lambda": 0.98,
# Initial coefficient for KL divergence.
"kl_coeff": 0.2,
# Target value for KL divergence.
"kl_target": 0.02,
# Size of batches collected from each worker.
"rollout_fragment_length": 64,
# Number of timesteps collected for each SGD round. This defines the size
# of each SGD epoch.
"train_batch_size": 4096,
# Total SGD batch size across all devices for SGD. This defines the
# minibatch size within each epoch.
"sgd_minibatch_size": 512,
# Number of SGD iterations in each outer loop (i.e., number of epochs to
# execute per train batch).
"num_sgd_iter": 1,
# Whether to shuffle sequences in the batch when training (recommended).
"shuffle_sequences": False,
# Stepsize of SGD.
"lr": 3e-5,
# Learning rate schedule.
"lr_schedule": None,
# Coefficient of the value function loss. IMPORTANT: you must tune this if
# you set vf_share_layers=True inside your model's config.
"vf_loss_coeff": 1.0,
"model": {
# Share layers for value function. If you set this to True, it's
# important to tune vf_loss_coeff.
"vf_share_layers": False,
# VisionNetwork (tf and torch): rllib.models.tf|torch.visionnet.py
# These are used if no custom model is specified and the input space is 2D.
# Filter config: List of [out_channels, kernel, stride] for each filter.
# Example:
# Use None for making RLlib try to find a default filter setup given the
# observation space.
"conv_filters": [
[16, [24, 32], [14, 18]],
[32, [6, 6], 4],
[256, [9, 9], 1],
],
# Activation function descriptor.
# Supported values are: "tanh", "relu", "swish" (or "silu"),
# "linear" (or None).
"conv_activation": "relu",
# Some default models support a final FC stack of n Dense layers with given
# activation:
# - Complex observation spaces: Image components are fed through
# VisionNets, flat Boxes are left as-is, Discrete are one-hot'd, then
# everything is concated and pushed through this final FC stack.
# - VisionNets (CNNs), e.g. after the CNN stack, there may be
# additional Dense layers.
# - FullyConnectedNetworks will have this additional FCStack as well
# (that's why it's empty by default).
"post_fcnet_hiddens": [28],
"post_fcnet_activation": "relu",
},
# Coefficient of the entropy regularizer.
"entropy_coeff": 0.00005,
# Decay schedule for the entropy regularizer.
"entropy_coeff_schedule": None,
# PPO clip parameter.
"clip_param": 0.2,
# Clip param for the value function. Note that this is sensitive to the
# scale of the rewards. If your expected V is large, increase this.
"vf_clip_param": 30.0,
# If specified, clip the global norm of gradients by this amount.
"grad_clip": None,
# Whether to rollout "complete_episodes" or "truncate_episodes".
"batch_mode": "complete_episodes",
# Which observation filter to apply to the observation.
"observation_filter": "NoFilter",
# Uses the sync samples optimizer instead of the multi-gpu one. This is
# usually slower, but you might want to try it if you run into issues with
# # the default optimizer.
"simple_optimizer": True,
# "reuse_actors": True,
"num_gpus": 1,
# Use the connector server to generate experiences.
"input": (
lambda ioctx: PolicyServerInput(ioctx, args.ip, 55556)
),
# Use a single worker process to run the server.
"num_workers": 0,
# Disable OPE, since the rollouts are coming from online clients.
"input_evaluation": [],
# "callbacks": MyCallbacks,
"env": RandomEnv,
"env_config": {
"sleep": True
},
"framework": "tf",
# "eager_tracing": True,
"explore": True,
# "exploration_config": {
# "type": "Curiosity", # <- Use the Curiosity module for exploring.
# "eta": 0.6, # Weight for intrinsic rewards before being added to extrinsic ones.
# "lr": 0.001, # Learning rate of the curiosity (ICM) module.
# "feature_dim": 1152, # Dimensionality of the generated feature vectors.
# # Setup of the feature net (used to encode observations into feature (latent) vectors).
# "inverse_net_hiddens": [64, 128], # Hidden layers of the "inverse" model.
# "inverse_net_activation": "relu", # Activation of the "inverse" model.
# "forward_net_hiddens": [64, 128], # Hidden layers of the "forward" model.
# "forward_net_activation": "relu", # Activation of the "forward" model.
# "beta": 0.2, # Weight for the "forward" loss (beta) over the "inverse" loss (1.0 - beta).
# # Specify, which exploration sub-type to use (usually, the algo's "default"
# # exploration, e.g. EpsilonGreedy for DQN, StochasticSampling for PG/SAC).
# "sub_exploration": {
# "type": "StochasticSampling",
# }
# },
"create_env_on_driver": False,
"log_sys_usage": False,
# "normalize_actions": False,
"compress_observations": True,
# Whether to fake GPUs (using CPUs).
# Set this to True for debugging on non-GPU machines (set `num_gpus` > 0).
"_fake_gpus": True
})
DEFAULT_CONFIG["env_config"]["observation_space"] = spaces.Box(low=0, high=255,
shape=(480, 640, 3), dtype=np.uint8)
DEFAULT_CONFIG["env_config"]["action_space"] = spaces.MultiDiscrete(
[
2, # W
2, # A
2, # S
2, # D
2, # Space
2, # H
2, # J
2, # K
2 # L
]
)
ray.init(log_to_driver=False)
trainer = PPOTrainer
from ray import tune
name = "" + args.checkpoint
print(f"Starting: {name}")
tune.run(trainer,
# resume = True,
config=DEFAULT_CONFIG, name=name, keep_checkpoints_num=None, checkpoint_score_attr="episode_reward_mean",
max_failures=1,
# restore="C:\\Users\\ashyk\\ray_results\\TEST_32k-batch_512-len_32_Run-2\\PPO_RandomEnv_46610_00000_0_2021-12-31_17-30-37\\checkpoint_000027\\checkpoint-27",
checkpoint_freq=1, checkpoint_at_end=True)
Thanks in advance!