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

[JIT] Add TorchScript Compatibility for ANIModel and Ensemble #307

Merged
merged 24 commits into from
Oct 9, 2019
Merged

Conversation

farhadrgh
Copy link
Member

This PR fixes one of the items in #305

Copy link
Contributor

@zasdfgbnm zasdfgbnm left a comment

Choose a reason for hiding this comment

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

I think the problem comes from the definition of Sequential: When JIT is trying to compile the code for Sequential, it assumes that the input of Sequential.forward is a Tensor. I think we should eventually remove Sequential, but write our own class with correct type annotation of forward instead. But for now, this PR, why not just

        self.model_iterator = torch.jit.script(self.model_iterator)
        self.ensemble = torch.nn.Sequential(self.aev_computer, self.model_iterator)

Instead of

        self.ensemble = torch.nn.Sequential(self.aev_computer, self.model_iterator)
        self.ensemble = torch.jit.script(self.ensemble)

and leave the problem of Sequencial to fix it in later PR?

@farhadrgh
Copy link
Member Author

Problem with type annotation shows up every where torch.nn.Sequantial is used. I submitted a PR (#308) to keep things in order.

@farhadrgh farhadrgh changed the title [JIT] Add TorchScript Compatibility for Ensemble [WIP][JIT] Add TorchScript Compatibility for Ensemble Sep 30, 2019
@zasdfgbnm
Copy link
Contributor

@farhadrgh Should be working

@zasdfgbnm zasdfgbnm changed the title [WIP][JIT] Add TorchScript Compatibility for Ensemble [JIT] Add TorchScript Compatibility for Ensemble Oct 9, 2019
@zasdfgbnm zasdfgbnm changed the title [JIT] Add TorchScript Compatibility for Ensemble [JIT] Add TorchScript Compatibility for ANIModel and Ensemble Oct 9, 2019
Copy link
Contributor

@zasdfgbnm zasdfgbnm left a comment

Choose a reason for hiding this comment

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

@farhadrgh I am giving out approval. If it also looks good to you, then please merge.

@farhadrgh
Copy link
Member Author

Looks good, thanks

@farhadrgh farhadrgh merged commit a1adceb into master Oct 9, 2019
@farhadrgh farhadrgh deleted the jit branch October 9, 2019 18:54
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.

2 participants