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

Populate float_answer for Tapas Weak supervision for aggregation (WTQ). TypeError: Parameter to CopyFrom() must be instance of same class: expected language.tapas.Question got str. #162

Open
ayazhankadessova opened this issue Jun 15, 2022 · 2 comments

Comments

@ayazhankadessova
Copy link

ayazhankadessova commented Jun 15, 2022

I am trying to fine-tune Tapas following the instructions here: https://huggingface.co/transformers/v4.3.0/model_doc/tapas.html#usage-fine-tuning , Weak supervision for aggregation (WTQ) using the https://www.microsoft.com/en-us/download/details.aspx?id=54253 , which follow the required format of dataset in the SQA format, tsv files with most of the named columns. But, there is no float_answer column. And as mentioned,

float_answer: the float answer to the question, if there is one (np.nan if there isn’t). Only required in case of weak supervision for aggregation (such as WTQ and WikiSQL)

Since I am using WTQ, I need the float_answer column. I tried populating float_answer based on answer_text as suggested here, using https://github.com/google-research/tapas/blob/master/tapas/utils/interaction_utils_parser.py 's parse_question(table, question, mode) function. However, I am getting errors.

I copied everything from here and put these args:
Screenshot 2022-06-15 at 2 07 13 PM .

But, I get this error: TypeError: Parameter to CopyFrom() must be instance of same class: expected language.tapas.Question got str.
Screenshot 2022-06-15 at 2 08 07 PM

1) Can you, please help understand what args should I Use or how else can I populate float_answer?

I am using table_csv and the question, answer to which is in the table given:
Screenshot 2022-06-15 at 2 10 21 PM

2) Also we have tried to simply add float_answer column and make all the values np.nan. Crashed, too.

encoding["float_answer"] = torch.tensor(float("nan"))

Is there tutorial for WTQ fine-tuning? Thanx!

@ayazhankadessova ayazhankadessova changed the title Hi Niels! Populate float_answer for Tapas Weak supervision for aggregation (WTQ). TypeError: Parameter to CopyFrom() must be instance of same class: expected language.tapas.Question got str. Jun 15, 2022
@Deepazzz
Copy link

Hi,
Did you get any soln for the same, I facing the same issue.

@mohammedshaneeb-ai
Copy link

HI @ayazhankadessova
How you handled float_answer column ( in the case of string answers like name,place) if there is no answer .
and also how you handled answer_coordinates column ( in the case of aggregations answers like sum,avg etc)
if there is no answer

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

No branches or pull requests

3 participants