Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RLlib] Support native tf.keras.Model (milestone toward obsoleting ModelV2 class). #14684

Merged
merged 48 commits into from
Apr 27, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
7c5f7ce
WIP.
sven1977 Dec 23, 2020
8f74a7b
WIP.
sven1977 Dec 23, 2020
a8cb715
WIP.
sven1977 Dec 23, 2020
43fcfc5
WIP.
sven1977 Dec 23, 2020
8f95df7
Fix.
sven1977 Dec 24, 2020
ef80373
Merge branch 'bc_marwil_minor_cleanups' into obsolete_usage_tracking_…
sven1977 Dec 24, 2020
8dd46c2
Merge branch 'master' of https://github.com/ray-project/ray into obso…
sven1977 Dec 26, 2020
40a6d8b
Fixes and LINT.
sven1977 Dec 26, 2020
e6e8ecb
Merge branch 'master' of https://github.com/ray-project/ray into obso…
sven1977 Dec 27, 2020
bb728ef
Fixes and LINT.
sven1977 Dec 27, 2020
4f16efe
WIP.
sven1977 Dec 28, 2020
56a4e1b
Merge branch 'master' of https://github.com/ray-project/ray into obso…
sven1977 Mar 13, 2021
371a298
wip
sven1977 Mar 13, 2021
bdb7c93
wip
sven1977 Mar 14, 2021
f03f49d
wip
sven1977 Mar 14, 2021
d4e31de
wip
sven1977 Mar 14, 2021
1988c53
wip
sven1977 Mar 14, 2021
493424a
wip
sven1977 Mar 14, 2021
a74d668
wip
sven1977 Mar 14, 2021
a979ca8
wip
sven1977 Mar 15, 2021
e93354a
Merge branch 'master' of https://github.com/ray-project/ray into obso…
sven1977 Mar 15, 2021
3fa7e55
wip
sven1977 Mar 15, 2021
deaa7f5
wip
sven1977 Mar 15, 2021
287ea97
Merge branch 'master' of https://github.com/ray-project/ray into obso…
sven1977 Mar 18, 2021
214332a
wip.
sven1977 Mar 18, 2021
94f8f71
Merge branch 'master' of https://github.com/ray-project/ray into obso…
sven1977 Mar 23, 2021
b92c702
fix.
sven1977 Mar 23, 2021
b393f03
wip.
sven1977 Mar 23, 2021
d33afea
Merge branch 'master' of https://github.com/ray-project/ray into obso…
sven1977 Mar 27, 2021
e41d4ef
wip.
sven1977 Mar 27, 2021
eb2ab5d
Merge branch 'master' of https://github.com/ray-project/ray into obso…
sven1977 Apr 10, 2021
96bacbf
Merge branch 'master' of https://github.com/ray-project/ray into obso…
sven1977 Apr 10, 2021
0a5bf55
wip.
sven1977 Apr 10, 2021
32f5140
fix
sven1977 Apr 10, 2021
131ec8f
fix and LINT.
sven1977 Apr 11, 2021
7c11cec
Merge branch 'master' of https://github.com/ray-project/ray into obso…
sven1977 Apr 11, 2021
76cdc92
fixes.
sven1977 Apr 11, 2021
b8ea5a1
Merge branch 'master' of https://github.com/ray-project/ray into obso…
sven1977 Apr 11, 2021
301e6f9
fixes.
sven1977 Apr 11, 2021
f097b81
fix and LINT.
sven1977 Apr 11, 2021
6ddb1a6
Merge branch 'master' of https://github.com/ray-project/ray into obso…
sven1977 Apr 12, 2021
86c6349
wip.
sven1977 Apr 13, 2021
e07ed80
Merge branch 'master' of https://github.com/ray-project/ray into obso…
sven1977 Apr 13, 2021
4677ee5
Merge branch 'master' of https://github.com/ray-project/ray into obso…
sven1977 Apr 15, 2021
400092c
Merge branch 'master' of https://github.com/ray-project/ray into obso…
sven1977 Apr 15, 2021
469fca6
Merge branch 'master' of https://github.com/ray-project/ray into obso…
sven1977 Apr 15, 2021
ab31bf5
Merge branch 'master' of https://github.com/ray-project/ray into obso…
sven1977 Apr 19, 2021
d768a0e
Merge branch 'master' of https://github.com/ray-project/ray into obso…
sven1977 Apr 20, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
WIP.
  • Loading branch information
sven1977 committed Dec 28, 2020
commit 4f16efea6f85f481ce6b08fd366f794306062e48
5 changes: 0 additions & 5 deletions rllib/policy/eager_tf_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from ray.rllib.utils import add_mixins, force_list
from ray.rllib.utils.annotations import override
from ray.rllib.utils.framework import try_import_tf
from ray.rllib.utils.tf_ops import convert_to_non_tf_type

tf1, tf, tfv = try_import_tf()
logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -651,10 +650,6 @@ def _lazy_tensor_dict(self, postprocessed_batch):
postprocessed_batch.set_get_interceptor(_convert_to_tf)
return postprocessed_batch

def _lazy_numpy_dict(self, postprocessed_batch):
postprocessed_batch.set_get_interceptor(convert_to_non_tf_type)
return postprocessed_batch

@classmethod
def with_tracing(cls):
return traced_eager_policy(cls)
Expand Down
1 change: 1 addition & 0 deletions rllib/policy/policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,7 @@ def _initialize_loss_from_dummy_batch(
self.view_requirements[key] = \
ViewRequirement(space=gym.spaces.Box(
-1.0, 1.0, shape=value.shape[1:], dtype=value.dtype))
self._dummy_batch.set_get_interceptor(None)
self.exploration.postprocess_trajectory(self, self._dummy_batch)
postprocessed_batch = self.postprocess_trajectory(self._dummy_batch)
seq_lens = None
Expand Down
3 changes: 2 additions & 1 deletion rllib/policy/sample_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ def copy(self) -> "SampleBatch":
k: np.array(v, copy=True) if isinstance(v, np.ndarray) else v
for (k, v) in self.data.items()
},
_seq_lens=self.seq_lens)
_seq_lens=self.seq_lens,
_dont_check_lens=self.dont_check_lens)
copy_.set_get_interceptor(self.get_interceptor)
return copy_

Expand Down
7 changes: 2 additions & 5 deletions rllib/policy/torch_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,15 +599,12 @@ def import_model_from_h5(self, import_file: str) -> None:
return self.model.import_from_h5(import_file)

def _lazy_tensor_dict(self, postprocessed_batch):
if not isinstance(postprocessed_batch, SampleBatch):
postprocessed_batch = SampleBatch(postprocessed_batch)
postprocessed_batch.set_get_interceptor(
functools.partial(convert_to_torch_tensor, device=self.device))
return postprocessed_batch

def _lazy_numpy_dict(self, postprocessed_batch):
postprocessed_batch.set_get_interceptor(
functools.partial(convert_to_non_torch_type))
return postprocessed_batch


# TODO: (sven) Unify hyperparam annealing procedures across RLlib (tf/torch)
# and for all possible hyperparams, not just lr.
Expand Down