-
Notifications
You must be signed in to change notification settings - Fork 375
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
feature(zms): add new league middlewares and other models and tools. #458
base: main
Are you sure you want to change the base?
Conversation
…gine into dev-league-lxl
…ansitionList, make battle_rolloutor_for_distar run in dict and list cases
@@ -75,3 +75,38 @@ def __init__(self, *args, **kwargs) -> None: | |||
self.last_eval_iter = -1 | |||
|
|||
self.keep('train_iter', 'last_eval_iter') | |||
|
|||
|
|||
class BattleContext(Context): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add overview comments
@@ -91,3 +93,29 @@ def forward(self, x: torch.Tensor, spatial_size: Tuple[int, int], location: torc | |||
output = output.reshape(N, B, H, W) | |||
output = output.permute(1, 0, 2, 3).contiguous() | |||
return output | |||
|
|||
|
|||
def scatter_connection_v2(shape, project_embeddings, entity_location, scatter_dim, scatter_type='add'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we merge v2 to original ScatterConnection
return x | ||
|
||
|
||
def build_activation2(activation): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should merge this function into original version
from ding.framework import Task, Context | ||
from ding.league.v2 import BaseLeague | ||
from ding.league.player import PlayerMeta | ||
from ding.league.v2.base_league import Job |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on import from 2-level directory, like from ding.league.v2 import BaseLeague, Job
sleep(1) | ||
log_every_sec( | ||
logging.INFO, 600, "[Coordinator {}] running jobs {}".format(task.router.node_id, self._running_jobs) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we should add state_dict/load_state_dict method for coordinator?
def get_job_info(self, player_id): | ||
self.get_job_info_cnt += 1 | ||
other_players = [i for i in self.active_players_ids if i != player_id] | ||
another_palyer = random.choice(other_players) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
return unpickler.load() | ||
|
||
|
||
def my_pickle_loads(msg): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this function to ding/utils
|
||
@dataclass | ||
class PlayerModelInfo: | ||
get_new_model_time: float |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why two time here, maybe we can simplify them
# If we don't have Trajectory(t-1), i.e. the length of the whole episode is smaller than unroll_len, | ||
# we fill up the trajectory with the first element of episode. | ||
return_episode = [] | ||
i = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why init i
here
initial_elements.append(trajectory[0]) | ||
trajectory = initial_elements + trajectory | ||
if self._last_step_fn: | ||
last_step = deepcopy(trajectory[-1]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why deepcopy here
task.router.node_id | ||
) | ||
|
||
ctx.n_episode = self.cfg.policy.collect.n_episode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
repeat?
time_begin = time.time() | ||
collector(ctx) | ||
|
||
if ctx.job_finish is True: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ctx.job_finish
) | ||
) | ||
|
||
gc.collect() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why call gc here
Description
Related Issue
TODO
Check List