Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Code:
- environment = Environment.create(environment=env)
- agent = Agent.create(
- agent='ac', environment=environment, batch_size=64,
- network=[
- dict(type='flatten'),
- dict(type='gru', size=256, horizon=env._window_size, activation='relu'),
- dict(type='dense', size=64, activation='relu'),
- dict(type='dense', size=env.action_space.n, activation='softmax'),
- ],
- critic=[
- dict(type='flatten'),
- dict(type='gru', size=256, horizon=env._window_size, activation='relu'),
- dict(type='dense', size=64, activation='relu'),
- dict(type='dense', size=1),
- ]
- )
- actions = agent.act(states=states)
- Error:
- File /opt/homebrew/Caskroom/miniforge/base/envs/venv-3.8/lib/python3.8/site-packages/tensorforce/agents/agent.py:415, in Agent.act(self, states, internals, parallel, independent, deterministic, evaluation)
- 410 if evaluation is not None:
- 411 raise TensorforceError.deprecated(
- 412 name='Agent.act', argument='evaluation', replacement='independent'
- 413 )
- --> 415 return super().act(
- 416 states=states, internals=internals, parallel=parallel, independent=independent,
- 417 deterministic=deterministic
- 418 )
- File /opt/homebrew/Caskroom/miniforge/base/envs/venv-3.8/lib/python3.8/site-packages/tensorforce/agents/recorder.py:262, in Recorder.act(self, states, internals, parallel, independent, deterministic, **kwargs)
- 260 # fn_act()
- 261 if self._is_agent:
- --> 262 actions, internals = self.fn_act(
- 263 states=states, internals=internals, parallel=parallel, independent=independent,
- 264 deterministic=deterministic, is_internals_none=is_internals_none,
- 265 num_parallel=num_parallel
- 266 )
- 267 else:
- 268 if batched:
- File /opt/homebrew/Caskroom/miniforge/base/envs/venv-3.8/lib/python3.8/site-packages/tensorforce/agents/agent.py:462, in Agent.fn_act(self, states, internals, parallel, independent, deterministic, is_internals_none, num_parallel)
- 460 # Model.act()
- 461 if not independent:
- --> 462 actions, timesteps = self.model.act(
- 463 states=states, auxiliaries=auxiliaries, parallel=parallel
- 464 )
- 465 self.timesteps = timesteps.numpy().item()
- 467 elif len(self.internals_spec) > 0:
- File /opt/homebrew/Caskroom/miniforge/base/envs/venv-3.8/lib/python3.8/site-packages/tensorforce/core/module.py:136, in tf_function.<locals>.decorator.<locals>.decorated(self, _initialize, *args, **kwargs)
- 134 # Apply function graph
- 135 with self:
- --> 136 output_args = function_graphs[str(graph_params)](*graph_args)
- 137 if not is_loop_body:
- 138 return output_signature.args_to_kwargs(
- 139 args=output_args, outer_tuple=True, from_dict=dict_interface
- 140 )
- File /opt/homebrew/Caskroom/miniforge/base/envs/venv-3.8/lib/python3.8/site-packages/tensorflow/python/util/traceback_utils.py:153, in filter_traceback.<locals>.error_handler(*args, **kwargs)
- 151 except Exception as e:
- 152 filtered_tb = _process_traceback_frames(e.__traceback__)
- --> 153 raise e.with_traceback(filtered_tb) from None
- 154 finally:
- 155 del filtered_tb
- File /opt/homebrew/Caskroom/miniforge/base/envs/venv-3.8/lib/python3.8/site-packages/tensorflow/python/eager/execute.py:54, in quick_execute(op_name, num_outputs, inputs, attrs, ctx, name)
- 52 try:
- 53 ctx.ensure_initialized()
- ---> 54 tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
- 55 inputs, attrs, num_outputs)
- 56 except core._NotOkStatusException as e:
- 57 if name is not None:
- InvalidArgumentError: Cannot assign a device for operation agent/VerifyFinite/CheckNumerics: Could not satisfy explicit device specification '' because the node {{colocation_node agent/VerifyFinite/CheckNumerics}} was colocated with a group of nodes that required incompatible device '/job:localhost/replica:0/task:0/device:GPU:0'. All available devices [/job:localhost/replica:0/task:0/device:CPU:0, /job:localhost/replica:0/task:0/device:GPU:0].
- Colocation Debug Info:
- Colocation group had the following types and supported devices:
- Root Member(assigned_device_name_index_=1 requested_device_name_='/job:localhost/replica:0/task:0/device:GPU:0' assigned_device_name_='/job:localhost/replica:0/task:0/device:GPU:0' resource_device_name_='/job:localhost/replica:0/task:0/device:GPU:0' supported_device_types_=[CPU] possible_devices_=[]
- Identity: GPU CPU
- Switch: GPU CPU
- CheckNumerics: CPU
- _Arg: GPU CPU
- Colocation members, user-requested devices, and framework assigned devices, if any:
- args_0 (_Arg) framework assigned device=/job:localhost/replica:0/task:0/device:GPU:0
- agent/VerifyFinite/CheckNumerics (CheckNumerics)
- agent/VerifyFinite/control_dependency (Identity)
- agent/assert_greater_equal/Assert/AssertGuard/args_0/_16 (Switch)
- agent/assert_less_equal/Assert/AssertGuard/args_0/_26 (Switch)
- Func/agent/StatefulPartitionedCall/input/_80 (Identity) /job:localhost/replica:0/task:0/device:GPU:0
- Func/agent/assert_greater_equal/Assert/AssertGuard/then/_10/input/_168 (Identity)
- Func/agent/assert_greater_equal/Assert/AssertGuard/else/_11/input/_174 (Identity)
- Func/agent/assert_less_equal/Assert/AssertGuard/then/_20/input/_180 (Identity)
- Func/agent/assert_less_equal/Assert/AssertGuard/else/_21/input/_186 (Identity)
- Func/agent/StatefulPartitionedCall/state_preprocessing/PartitionedCall/input/_275 (Identity) /job:localhost/replica:0/task:0/device:GPU:0
- Func/agent/StatefulPartitionedCall/state_preprocessing/PartitionedCall/linear_normalization0/PartitionedCall/input/_389 (Identity) /job:localhost/replica:0/task:0/device:GPU:0
- [[{{node agent/VerifyFinite/CheckNumerics}}]] [Op:__inference_act_2178]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement