Skip to content

Commit

Permalink
polish config
Browse files Browse the repository at this point in the history
  • Loading branch information
karroyan committed Aug 28, 2023
1 parent 297831d commit 0f440b5
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/platform_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
with:
python-version: ${{ (matrix.os == 'macos-latest' && matrix.python-version == '3.7') && '3.7.16' || matrix.python-version }}
- name: do_platform_test
timeout-minutes: 120
timeout-minutes: 30
run: |
python -m pip install .
python -m pip install ".[test,k8s]"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: do_unittest
timeout-minutes: 120
timeout-minutes: 40
run: |
python -m pip install box2d-py
python -m pip install .
Expand Down
4 changes: 3 additions & 1 deletion ding/model/common/encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ def __init__(
else:
layers = []
for i in range(len(hidden_size_list)):
layers.append(ResFCBlock(hidden_size_list[0], activation=self.act, norm_type=norm_type))
layers.append(
ResFCBlock(hidden_size_list[0], activation=self.act, norm_type=norm_type, dropout=dropout)
)
self.main = nn.Sequential(*layers)
else:
layers = []
Expand Down
1 change: 1 addition & 0 deletions ding/model/template/q_learning.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def __init__(
)
# Conv Encoder
elif len(obs_shape) == 3:
assert dropout is None, "dropout is not supported in ConvEncoder"
self.encoder = ConvEncoder(obs_shape, encoder_hidden_size_list, activation=activation, norm_type=norm_type)
else:
raise RuntimeError(
Expand Down
2 changes: 0 additions & 2 deletions ding/policy/dqn.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ class DQNPolicy(Policy):
model=dict(
#(list(int)) Sequence of ``hidden_size`` of subsequent conv layers and the final dense layer.
encoder_hidden_size_list=[128, 128, 64],
# (float) Dropout rate for dropout layers. When set to ``None`` means no dropout layers.
dropout=None,
),
learn=dict(
# (int) How many updates(iterations) to train after collector's one collection.
Expand Down
4 changes: 3 additions & 1 deletion ding/torch_utils/network/res_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ def __init__(
self.act = activation
if dropout is not None:
self.dropout = nn.Dropout(dropout)
else:
self.dropout = None
self.fc1 = fc_block(in_channels, in_channels, activation=self.act, norm_type=norm_type)
self.fc2 = fc_block(in_channels, in_channels, activation=None, norm_type=norm_type)

Expand All @@ -143,6 +145,6 @@ def forward(self, x: torch.Tensor) -> torch.Tensor:
x = self.fc1(x)
x = self.fc2(x)
x = self.act(x + identity)
if hasattr(self, 'dropout'):
if self.dropout is not None:
x = self.dropout(x)
return x

0 comments on commit 0f440b5

Please sign in to comment.