guotong1988 / NL2SQL-RULE

Content Enhanced BERT-based Text-to-SQL Generation https://arxiv.org/abs/1910.07179
188 stars 48 forks source link

Problem while running train.py #2

Closed Sourish97 closed 4 years ago

Sourish97 commented 4 years ago

Hello, I tried to clone your repo and run it on my local system. However when I try a normal python train.py or the command mentioned in sqlova repository, I get the following error

python train.py

BERT-type: uncased_L-12_H-768_A-12
Batch_size = 32
BERT parameters:
learning rate: 1e-05
Fine-tune BERT: False
Traceback (most recent call last):
  File "train.py", line 703, in <module>
    model, model_bert, tokenizer, bert_config = get_models(args, BERT_PT_PATH)
  File "train.py", line 164, in get_models
    args.no_pretraining)
  File "train.py", line 124, in get_bert
    bert_config.print_status()
AttributeError: 'BertConfig' object has no attribute 'print_status'

When I comment out bert_config.print_status(), I get another error as following

BERT-type: uncased_L-12_H-768_A-12
Batch_size = 32
BERT parameters:
learning rate: 1e-05
Fine-tune BERT: False
Traceback (most recent call last):
  File "train.py", line 703, in <module>
    model, model_bert, tokenizer, bert_config = get_models(args, BERT_PT_PATH)
  File "train.py", line 164, in get_models
    args.no_pretraining)
  File "train.py", line 126, in get_bert
    model_bert = BertModel(bert_config)
TypeError: __init__() missing 2 required positional arguments: 'is_training' and 'input_ids'

Any solution to this?

guotong1988 commented 4 years ago

I have uploaded some code. Please update and try again.

Sourish97 commented 4 years ago

Same error again with the python command you provided

guotong1988 commented 4 years ago

I have uploaded the config file.

guotong1988 commented 4 years ago

You should find why bert_config.print_status() fails.

TobiasBrx commented 4 years ago

I have the same error

musamaalvi commented 4 years ago

I have the same error

Did you find the solution ?

siddharthrawal121 commented 4 years ago

@Sourish97 @TobiasBrx @musamaalvi Did u guys find anything?

guotong1988 commented 4 years ago

I will take a look

musamaalvi commented 4 years ago

@siddharthrawal121 yes,

what I did is simply I stopped importing BertConfig. Comment the below line in your code

from bert.modeling import BertConfig, BertModel

After this copy all the code from bert.modeling file and paste it into train.py. This resolved the issue for me.

siddharthrawal121 commented 4 years ago

Hi @musamaalvi. I tried it didnt work and when I checked the code there is no method or class in bert.config for print_status. Maybe they removed print_status in later version. Which bert version are you using?

siddharthrawal121 commented 4 years ago

@musamaalvi Nvm , fixed the issue by using the the modelling.py in bert folder of NL2SQL-RULE

guotong1988 commented 4 years ago

it seems export PYTHONPATH=/your/project/root/ I guess.

siddharthrawal121 commented 4 years ago

yes @guotong1988. I solved it