-
Notifications
You must be signed in to change notification settings - Fork 548
fix TCAV for tiny-bert model report AssertionError: inputs must have type torch.Tensor but <class 'list'> found: error happened #1077
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
Conversation
…type torch.Tensor but <class 'list'> found: error happened
|
Hi @joshua-xia , why do you need this change? We do not plan to expand the support of input types for now. The inputs can be a single tensor or a series of tensor. If the inputs is a series of tensors, Captum expects it to be passed in as But the error message can be improved to explicitly mention |
we have the multi-parameters forward function as: def forward(self, input_ids, token_type_ids=None, attention_mask=None, labels=None): The TCAV of captum must be comptiable to this kind of forward function. Thanks! |
|
@joshua-xia, is |
input_ids, token_type_ids, attention_mask, labels can all be list or at least one is list. |
Summary: Discussed in #1077 (comment) , improving the error message of invalid `inputs` to tell the two types we allow: `Tensor` and `tuple[Tensor]` Pull Request resolved: #1083 Reviewed By: vivekmig Differential Revision: D41795064 Pulled By: aobo-y fbshipit-source-id: 16370e747d08ec33070fc039d9ee2b6dde033cc8
|
Captum has no issue with multi-parameter inputs. We just require they are formatted as inputs = (input_1, input_2)
def wrapper(*args):
return your_model(list(args))
# your model will receive [input_1, input_2]Let us know if this does not solve your problem. We can reopen this. It is better if you can provide us some code showing how you are using it. We don't need your company code, just pseudo code showing us the interface and data type. |
Hi, if the input of my model requires seqs such as "hello, bro!", can I use a wrapper or other ways to solve the issue that the first param of |
fix this issue if the inputs is list, and convert the list to tuple, the fix has been verified on my testcase