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

Issue when working with type annotation in Python mode #4

Open
failable opened this issue Mar 17, 2021 · 2 comments
Open

Issue when working with type annotation in Python mode #4

failable opened this issue Mar 17, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@failable
Copy link

The auto generated docstring has some issues with type hintings in Python mode. The type of the first argument is generated as [type] and the types of the following arguments seems shifted:

def forward(
    self,
    input_ids: torch.LongTensor,
    position_ids: torch.LongTensor,
    token_type_ids: torch.LongTensor,
) -> torch.FloatTensor:
    """[summary]

    Args:
        input_ids ([type]): [description]
        position_ids (torch.LongTensor): [description]
        token_type_ids (torch.LongTensor): [description]
         (torch.LongTensor): [description] 

    Returns:
        torch.FloatTensor: [description]
    """
    input_embeddings = self.word_embeddings(input_ids)
    position_embeddings = self.position_embeddings(position_ids)
    token_type_embeddings = self.token_type_embeddings(token_type_ids)

    embeddings = input_embeddings + token_type_embeddings + position_embeddings
    embeddings = self.layer_norm(embeddings)
    embeddings = self.dropout(embeddings)

    return embeddings
@jcs090218 jcs090218 added the bug Something isn't working label Mar 17, 2021
@jcs090218
Copy link
Member

This is issue with parsing python arguments. The current python parser is pretty fragile and I would need to take a deeper look on the day. Sorry for the inconvenience!

@jcs090218
Copy link
Member

Just to mentioned, there is another alternative ts-docstr. It's base on tree-sitter, we can now parse parameters in a much dedicated way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants