Advertisement
Guest User

Untitled

a guest
Sep 4th, 2022
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.79 KB | None | 0 0
  1. Code:
  2.  
  3. environment = Environment.create(environment=env)
  4.  
  5. agent = Agent.create(
  6. agent='ac', environment=environment, batch_size=64,
  7. network=[
  8. dict(type='flatten'),
  9. dict(type='gru', size=256, horizon=env._window_size, activation='relu'),
  10. dict(type='dense', size=64, activation='relu'),
  11. dict(type='dense', size=env.action_space.n, activation='softmax'),
  12. ],
  13. critic=[
  14. dict(type='flatten'),
  15. dict(type='gru', size=256, horizon=env._window_size, activation='relu'),
  16. dict(type='dense', size=64, activation='relu'),
  17. dict(type='dense', size=1),
  18. ]
  19. )
  20.  
  21. actions = agent.act(states=states)
  22.  
  23.  
  24. Error:
  25.  
  26. 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)
  27. 410 if evaluation is not None:
  28. 411 raise TensorforceError.deprecated(
  29. 412 name='Agent.act', argument='evaluation', replacement='independent'
  30. 413 )
  31. --> 415 return super().act(
  32. 416 states=states, internals=internals, parallel=parallel, independent=independent,
  33. 417 deterministic=deterministic
  34. 418 )
  35.  
  36. 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)
  37. 260 # fn_act()
  38. 261 if self._is_agent:
  39. --> 262 actions, internals = self.fn_act(
  40. 263 states=states, internals=internals, parallel=parallel, independent=independent,
  41. 264 deterministic=deterministic, is_internals_none=is_internals_none,
  42. 265 num_parallel=num_parallel
  43. 266 )
  44. 267 else:
  45. 268 if batched:
  46.  
  47. 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)
  48. 460 # Model.act()
  49. 461 if not independent:
  50. --> 462 actions, timesteps = self.model.act(
  51. 463 states=states, auxiliaries=auxiliaries, parallel=parallel
  52. 464 )
  53. 465 self.timesteps = timesteps.numpy().item()
  54. 467 elif len(self.internals_spec) > 0:
  55.  
  56. 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)
  57. 134 # Apply function graph
  58. 135 with self:
  59. --> 136 output_args = function_graphs[str(graph_params)](*graph_args)
  60. 137 if not is_loop_body:
  61. 138 return output_signature.args_to_kwargs(
  62. 139 args=output_args, outer_tuple=True, from_dict=dict_interface
  63. 140 )
  64.  
  65. 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)
  66. 151 except Exception as e:
  67. 152 filtered_tb = _process_traceback_frames(e.__traceback__)
  68. --> 153 raise e.with_traceback(filtered_tb) from None
  69. 154 finally:
  70. 155 del filtered_tb
  71.  
  72. 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)
  73. 52 try:
  74. 53 ctx.ensure_initialized()
  75. ---> 54 tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
  76. 55 inputs, attrs, num_outputs)
  77. 56 except core._NotOkStatusException as e:
  78. 57 if name is not None:
  79.  
  80. 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].
  81. Colocation Debug Info:
  82. Colocation group had the following types and supported devices:
  83. 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_=[]
  84. Identity: GPU CPU
  85. Switch: GPU CPU
  86. CheckNumerics: CPU
  87. _Arg: GPU CPU
  88.  
  89. Colocation members, user-requested devices, and framework assigned devices, if any:
  90. args_0 (_Arg) framework assigned device=/job:localhost/replica:0/task:0/device:GPU:0
  91. agent/VerifyFinite/CheckNumerics (CheckNumerics)
  92. agent/VerifyFinite/control_dependency (Identity)
  93. agent/assert_greater_equal/Assert/AssertGuard/args_0/_16 (Switch)
  94. agent/assert_less_equal/Assert/AssertGuard/args_0/_26 (Switch)
  95. Func/agent/StatefulPartitionedCall/input/_80 (Identity) /job:localhost/replica:0/task:0/device:GPU:0
  96. Func/agent/assert_greater_equal/Assert/AssertGuard/then/_10/input/_168 (Identity)
  97. Func/agent/assert_greater_equal/Assert/AssertGuard/else/_11/input/_174 (Identity)
  98. Func/agent/assert_less_equal/Assert/AssertGuard/then/_20/input/_180 (Identity)
  99. Func/agent/assert_less_equal/Assert/AssertGuard/else/_21/input/_186 (Identity)
  100. Func/agent/StatefulPartitionedCall/state_preprocessing/PartitionedCall/input/_275 (Identity) /job:localhost/replica:0/task:0/device:GPU:0
  101. Func/agent/StatefulPartitionedCall/state_preprocessing/PartitionedCall/linear_normalization0/PartitionedCall/input/_389 (Identity) /job:localhost/replica:0/task:0/device:GPU:0
  102.  
  103. [[{{node agent/VerifyFinite/CheckNumerics}}]] [Op:__inference_act_2178]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement