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

refactor(lyd): refactor dt_policy in new pipeline and add img input support #693

Merged
merged 27 commits into from
Aug 19, 2023

Conversation

AltmanD
Copy link
Collaborator

@AltmanD AltmanD commented Jul 25, 2023

Refactor DT to new pipeline.
Add img input support for atari.

@AltmanD AltmanD marked this pull request as ready for review July 25, 2023 09:31
@AltmanD AltmanD marked this pull request as draft July 25, 2023 09:35
@AltmanD AltmanD marked this pull request as ready for review July 25, 2023 09:36
@AltmanD AltmanD requested a review from PaParaZz1 July 25, 2023 11:14
@AltmanD AltmanD added the refactor refactor module or component label Jul 25, 2023
dizoo/box2d/lunarlander/config/lunarlander_dt_config.py Outdated Show resolved Hide resolved
@@ -27,7 +27,7 @@
embed_dim=128,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove old decision transformer config

dizoo/d4rl/config/__init__.py Show resolved Hide resolved
ding/policy/decision_transformer.py Outdated Show resolved Hide resolved
ding/envs/env_wrappers/env_wrappers.py Show resolved Hide resolved
ding/example/dt_atari.py Outdated Show resolved Hide resolved
self._optimizer, lambda steps: min((steps + 1) / warmup_steps, 1)
)

self.max_env_score = -1.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this

ding/policy/dt.py Outdated Show resolved Hide resolved
ding/framework/middleware/functional/data_processor.py Outdated Show resolved Hide resolved
ding/model/template/decision_transformer.py Outdated Show resolved Hide resolved
ding/model/template/dt.py Outdated Show resolved Hide resolved
ding/torch_utils/network/transformer.py Outdated Show resolved Hide resolved
dizoo/atari/config/pong_dt_config.py Outdated Show resolved Hide resolved
ding/policy/dt.py Outdated Show resolved Hide resolved
ding/policy/dt.py Outdated Show resolved Hide resolved
self.states = torch.zeros((self.eval_batch_size, self.max_eval_ep_len,) + tuple(self.state_dim), dtype=torch.float32, device=self.device)
self.running_rtg = [self.rtg_target for _ in range(self.eval_batch_size)]
else:
self.running_rtg = [self.rtg_target / self.rtg_scale for _ in range(self.eval_batch_size)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove rtg_scale argument

ding/policy/dt.py Outdated Show resolved Hide resolved
ding/policy/dt.py Outdated Show resolved Hide resolved
ding/utils/data/dataset.py Outdated Show resolved Hide resolved
ding/utils/data/dataset.py Outdated Show resolved Hide resolved
return timesteps, states, actions, rtgs, traj_mask


class FixedReplayBuffer(object):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we merge this class into the above class?

ding/utils/data/dataset.py Outdated Show resolved Hide resolved
@PaParaZz1 PaParaZz1 merged commit 3a73dd4 into opendilab:main Aug 19, 2023
9 of 18 checks passed
@AltmanD AltmanD deleted the dev-dt branch August 23, 2023 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor refactor module or component
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants