Skip to content

Commit

Permalink
fix ddp autounit UTs (pytorch#503)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: pytorch#503

# Context
DDP UTs are broken. Reason is we're using underlying `get_swa_multi_avg_fn` which doesn't support integers (our labels) any longer. The proper solution would be to get `get_swa_multi_avg_fn` to support ints, but for now implementing this as a fix to get UTs properly running.

# This diff
Add a custom `avg_fn` to unblock tests

Reviewed By: JKSenthil

Differential Revision: D48337970

fbshipit-source-id: 760ba0fcbec746e3a4c550a5e738a7bedd782555
  • Loading branch information
galrotem authored and facebook-github-bot committed Aug 15, 2023
1 parent 66e3275 commit 14a673a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/framework/test_auto_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ def forward(self, x):
return x

my_module = Net()
my_swa_params = SWAParams(epoch_start=1, anneal_epochs=3)
my_swa_params = SWAParams(
epoch_start=1, anneal_epochs=3, avg_fn=lambda x, y, z: x
)

auto_unit = DummyAutoUnit(
module=my_module,
Expand Down Expand Up @@ -625,7 +627,9 @@ def forward(self, x):
return x

my_module = Net()
my_swa_params = SWAParams(epoch_start=1, anneal_epochs=3)
my_swa_params = SWAParams(
epoch_start=1, anneal_epochs=3, avg_fn=lambda x, y, z: x
)

auto_unit = DummyAutoUnit(
module=my_module,
Expand Down

0 comments on commit 14a673a

Please sign in to comment.