mirror of
https://github.com/vale981/ray
synced 2025-03-05 18:11:42 -05:00
[RLlib] Fix some missing f-strings and a f-string related bug in tf eager policy. (#24148)
This commit is contained in:
parent
56bc90ca72
commit
3589c21924
4 changed files with 6 additions and 6 deletions
|
@ -1522,7 +1522,7 @@ class RolloutWorker(ParallelIteratorWorker):
|
|||
f"PolicyID '{pid}' was probably added on-the-fly (not"
|
||||
" part of the static `multagent.policies` config) and"
|
||||
" no PolicySpec objects found in the pickled policy "
|
||||
"state. Will not add `{pid}`, but ignore it for now."
|
||||
f"state. Will not add `{pid}`, but ignore it for now."
|
||||
)
|
||||
else:
|
||||
self.add_policy(
|
||||
|
|
|
@ -745,7 +745,7 @@ def _env_runner(
|
|||
simple_image_viewer.imshow(rendered)
|
||||
elif rendered not in [True, False, None]:
|
||||
raise ValueError(
|
||||
"The env's ({base_env}) `try_render()` method returned an"
|
||||
f"The env's ({base_env}) `try_render()` method returned an"
|
||||
" unsupported value! Make sure you either return a "
|
||||
"uint8/w x h x 3 (RGB) image or handle rendering in a "
|
||||
"window and then return `True`."
|
||||
|
|
|
@ -516,8 +516,8 @@ def build_eager_tf_policy(
|
|||
_is_training=tf.constant(False),
|
||||
)
|
||||
if state_batches is not None:
|
||||
for s in enumerate(state_batches):
|
||||
input_dict["state_in_{i}"] = s
|
||||
for i, s in enumerate(state_batches):
|
||||
input_dict[f"state_in_{i}"] = s
|
||||
if prev_action_batch is not None:
|
||||
input_dict[SampleBatch.PREV_ACTIONS] = prev_action_batch
|
||||
if prev_reward_batch is not None:
|
||||
|
|
|
@ -260,7 +260,7 @@ def check_multiagent_environments(env: "MultiAgentEnv") -> None:
|
|||
if not env.action_space_contains(sampled_action):
|
||||
error = (
|
||||
_not_contained_error("action_space_sample", "action")
|
||||
+ "\n\n sampled_action {sampled_action}\n\n"
|
||||
+ f"\n\n sampled_action {sampled_action}\n\n"
|
||||
)
|
||||
raise ValueError(error)
|
||||
|
||||
|
@ -277,7 +277,7 @@ def check_multiagent_environments(env: "MultiAgentEnv") -> None:
|
|||
if not env.observation_space_contains(next_obs):
|
||||
error = (
|
||||
_not_contained_error("env.step(sampled_action)", "observation")
|
||||
+ ":\n\n next_obs: {next_obs} \n\n sampled_obs: {sampled_obs}"
|
||||
+ f":\n\n next_obs: {next_obs} \n\n sampled_obs: {sampled_obs}"
|
||||
)
|
||||
raise ValueError(error)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue