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

Porting DTNNEmbedding Layer #3415

Merged
merged 12 commits into from Jun 19, 2023
Merged

Conversation

GreatRSingh
Copy link
Contributor

@GreatRSingh GreatRSingh commented May 29, 2023

Description

This PR ports the DTNNEmbedding Layer.

Type of change

Please check the option that is related to your PR.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
    • In this case, we recommend to discuss your modification on GitHub issues before creating the PR
  • Documentations (modification for documents)

Checklist

  • My code follows the style guidelines of this project
    • Run yapf -i <modified file> and check no errors (yapf version must be 0.32.0)
    • Run mypy -p deepchem and check no errors
    • Run flake8 <modified file> --count and check no errors
    • Run python -m doctest <modified file> and check no errors
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New unit tests pass locally with my changes
  • I have checked my code and corrected any misspellings

@GreatRSingh
Copy link
Contributor Author

GreatRSingh commented May 30, 2023

Tasks:

  • Port Layer
  • Description in Documentation
  • Example
  • Shape and Properties Test
  • PyTorch Comparision Test

@shaipranesh2
Copy link
Contributor

@GreatRSingh The PR on overall looks good, just address the minor reviews that I have given.

deepchem/models/tests/test_layers.py Outdated Show resolved Hide resolved
deepchem/models/tests/test_layers.py Outdated Show resolved Hide resolved
deepchem/models/torch_models/layers.py Show resolved Hide resolved
@GreatRSingh
Copy link
Contributor Author

@shaipranesh2 Ready For Review.

@shaipranesh2
Copy link
Contributor

LGTM!
@rbharath Can you merge this PR.

Comment on lines 2987 to 2988
init: str, optional
Weight initialization for filters.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Need to specify what options are possible. Also this parameter needs a more descriptive name than init.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think 'init' name is apt there. Can you suggest what i should change it to?
I have written the options available for init. I have skipped some of the options as there seems to be too many of them, do you want that i write all of them.

Comment on lines 3031 to 3035
def forward(self, inputs):
"""
parent layers: atom_number
"""
atom_number = inputs
Copy link
Collaborator

Choose a reason for hiding this comment

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

Needs type hints. What is inputs?

Docstring needs to be updated it seems.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have made some changes here. I think something better can be done here do you have any suggestion.


def forward(self, inputs: torch.Tensor):
"""
parent layers: atom_number
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not clear what this is supposed to mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It means that it is getting a tensor called 'atom_number' as input from the parent layers.
Here parent layers is the location where this layer is used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

atom_number is used to choose the required embeddings.

@GreatRSingh
Copy link
Contributor Author

@tonydavis629 @shaipranesh2 Ready for review.

Comment on lines 3039 to 3046
"""parent layers: atom_number

Parameters
----------
inputs: torch.Tensor
Tensor containing the Atom number of Atoms whose embeddings are requested.

"""
Copy link
Collaborator

Choose a reason for hiding this comment

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

more explanation on what the function actually does, remove 'parent layers' if it doesn't have an explanation. Then also requires a return value with its type, shape and explanation.

@tonydavis629
Copy link
Collaborator

You have a yapf error in layers.py

Copy link
Member

@rbharath rbharath left a comment

Choose a reason for hiding this comment

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

LGTM from my end. Will merge in once @tonydavis629 and @shaipranesh2 approve

Copy link
Collaborator

@tonydavis629 tonydavis629 left a comment

Choose a reason for hiding this comment

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

Approved

@tonydavis629 tonydavis629 merged commit 67b83a2 into deepchem:master Jun 19, 2023
48 of 66 checks passed
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.

None yet

4 participants