Finetuning Operators

#3
by snedubey - opened

Hello. I wanted to finetune this model on my data and was wondering what operator indexes you used in order to initially train this model. For instance, I see that your model supports the "like" operator and wanted to know how I can finetune this for my data.

@snedubey

Hi, I use T5 model and tokenizer as a base, so it already support the token "like". Also, I think the result is depends on the finetune data, for example in my case, the data already contains the word "like" in query, so it can learn this word.

@juierror Say for instance that I wanted to train the model to specifically output " select * from table where studentID like "%1001%" " when I ask for a list of students whose ID's contain the sequence "1001", how would I go about training the "like" operator to adapt to my data? What about the "in" and "between" operators? How would I fine-tune other specific operators according to my data schema?

@snedubey

Sorry for late reply, actually, I have some code for this https://github.com/juierror/flan-t5-text-to-sql. The idea is simple, if you want to train model to know each operator Ex. like, in, between, your training data should contain it for traning the model. From the example code, you can see that I load the wikisql data and it should contain operator I want to train. (However, in this model, I use other dataset that have example about multiple table instead)

Hi, I wanted to ask how you are extracting the table name for given data because sometimes it creates its own table name. If I want to change the table name how can I do that?

@Nisha25

Sorry for late reply.

Actually, I didn't do anything special to extract the table name. The training data has the table name in it, and we fine-tuned the model with the hope that it would learn which token represents the table name. In this case, the model might not have learned it correctly.

Thank you so much for the reply. I have one more doubt: sometimes the model generates very complex queries for simple questions, unnecessarily adding a join operator which throws an error. Can you help with this issue?

@Nisha25

Hi, actually, I notice that as well. From my opinion, the data I used to finetuned the model right now is a little bit small, so the result is not good and I'm not sure how to improve the result.

I also provide the code for finetuned the model, so if you have your own data, you can try it as well

https://github.com/juierror/flan-t5-text-to-sql/blob/main/flan_t5_text2sql_multi_table.ipynb

can we train this on CPU as well? and what we should do if we have to add the domain information in the model

Sign up or log in to comment