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

Support **kwargs for PyTorch models. #21453

Closed
damccorm opened this issue Jun 4, 2022 · 6 comments
Closed

Support **kwargs for PyTorch models. #21453

damccorm opened this issue Jun 4, 2022 · 6 comments

Comments

@damccorm
Copy link
Contributor

damccorm commented Jun 4, 2022

Some models in Pytorch instantiating from torch.nn.Module, has extra parameters in the forward function call. These extra parameters can be passed as Dict or as positional arguments. 

Example of PyTorch models supported by Hugging Face -> https://huggingface.co/bert-base-uncased

Some torch models on Hugging face

Eg: https://huggingface.co/docs/transformers/model_doc/bert#transformers.BertModel


inputs = {
     input_ids: Tensor1,
     attention_mask: Tensor2,
     token_type_ids: Tensor3,
}

model = BertModel.from_pretrained("bert-base-uncased") # which is a  
# subclass of torch.nn.Module

outputs
= model(**inputs) # model forward method should be expecting the keys in the inputs as the positional
arguments.

 

Transformers integrated in Pytorch is supported by Hugging Face as well. 

 

Imported from Jira BEAM-14337. Original Jira may contain additional context.
Reported by: Anand Inguva.
Subtask of issue #21435

@damccorm
Copy link
Contributor Author

damccorm commented Jun 4, 2022

Unable to assign user @yeandy. If able, self-assign, otherwise tag @damccorm so that he can assign you. Because of GitHub's spam prevention system, your activity is required to enable assignment in this repo.

@yeandy
Copy link
Contributor

yeandy commented Jun 6, 2022

@damccorm I'm unable to self-assign. Is it because I don't have write permissions? Is there a GH action that can allow me to self-assign future issues?

@damccorm
Copy link
Contributor Author

damccorm commented Jun 6, 2022

One of the unfortunate downsides of moving to issues is that non-committers can't self-assign/triage issues that they didn't create by default. I think that's a workflow we'll need to support going forward though, I'll look into it. For the moment, I'd recommend commenting/declaring intent to work on any issues.

I have access through

beam/.asf.yaml

Line 39 in 4dce7b8

- damccorm
which gives triage permissions, unfortunately that's limited to 20 people though

@damccorm
Copy link
Contributor Author

damccorm commented Jun 6, 2022

Once #21719 is in, you should be able to do this with chat-op commands

@yeandy
Copy link
Contributor

yeandy commented Jun 6, 2022

Got it, thanks!

@tvalentyn
Copy link
Contributor

we decided to move forward with a separate param: #21806

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants