Skip to content

Flos fix#7384

Merged
LysandreJik merged 1 commit into
huggingface:masterfrom
marrrcin:flos_fix
Sep 28, 2020
Merged

Flos fix#7384
LysandreJik merged 1 commit into
huggingface:masterfrom
marrrcin:flos_fix

Conversation

@marrrcin

Copy link
Copy Markdown
Contributor

Fixes #7146

This basically unwraps the model that is used during training and can be either plain Module or DataParallel/DistributedDataParallel.


@staticmethod
def _actual_model(
model: Union[torch.nn.DataParallel, torch.nn.parallel.DistributedDataParallel, torch.nn.modules.Module]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: aren't them all subclasses of torch.nn.Module?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I wanted to be explicit, but I can change it if you think that's required.

@sgugger sgugger left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks a lot for the quick fix! This LGTM.

sirmammingtonham added a commit to sirmammingtonham/transformers that referenced this pull request Sep 26, 2020
Comment thread src/transformers/trainer.py
Comment thread tests/test_trainer.py
@marrrcin

Copy link
Copy Markdown
Contributor Author

Please merge at will, as this fix is blocking us (#7146 (comment)).

@LysandreJik
LysandreJik merged commit 4083a55 into huggingface:master Sep 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fine tune with local model raised torch.nn.modules.module.ModuleAttributeError: 'DataParallel' object has no attribute 'config'

4 participants