brunnurs / valuenet

ValueNet: A Neural Text-to-SQL Architecture Incorporating Values
Apache License 2.0
66 stars 22 forks source link

TypeError: string indices must be integers #21

Open cjkrn opened 3 years ago

cjkrn commented 3 years ago

I'm getting this error while trying to implement the project Valuenet (https://github.com/brunnurs/valuenet) on my laptop and I don't understand what exactly it means.

I'm getting this error after I try to train the Model using:- python src/main.py

Configuration:- Windows 10 home, Nvidia gtx 1650 with cuda enabled.

Output of wandb log file:-

** parsed configuration from command line and combine with constants **

argument: exp_name=exp

argument: seed=90

argument: toy=False

argument: data_set=spider

argument: batch_size=1

argument: cuda=False

argument: encoder_pretrained_model=bert-base-uncased

argument: max_seq_length=512

argument: num_epochs=5.0

argument: lr_base=0.001

argument: lr_connection=0.0001

argument: lr_transformer=2e-05

argument: scheduler_gamma=0.5

argument: max_grad_norm=1.0

argument: clip_grad=5.0

argument: loss_epoch_threshold=50

argument: sketch_loss_weight=1.0

argument: column_pointer=True

argument: embed_size=300

argument: hidden_size=300

argument: action_embed_size=128

argument: att_vec_size=300

argument: type_embed_size=128

argument: col_embed_size=300

argument: readout=identity

argument: column_att=affine

argument: dropout=0.3

argument: beam_size=5

argument: decode_max_time_step=40

argument: data_dir=data\spider

argument: model_output_dir=experiments

Run experiment 'exp__20210517_150422'

We use the device: 'cpu' and 0 gpu's.

Loading from datasets…

Load data from data\spider\original\tables.json. N=166

Load data from data\spider\train.json. N=7000

Load data from data\spider\dev.json. N=1032

Successfully loaded pre-trained transformer 'bert-base-uncased'

Use Column Pointer: True

Build optimizer and scheduler. Total training steps: 35000.0

Start training with 5.0 epochs

0%| | 0/5 [00:00<?, ?it/s]

Training: 0%| | 0/7000 [00:00<?, ?it/s]

Training: 0%| | 0/7000 [00:00<?, ?it/s]

0%| | 0/5 [00:00
sketch_loss_weight=sketch_loss_weight)

File "E:\Project\Implementation\valuenet1\valuenet\src\training.py", line 32, in train
sketch_loss, lf_loss = model.forward(examples)

File "E:\Project\Implementation\valuenet1\valuenet\src\model\model.py", line 117, in forward
batch.values)

File "D:\Python\Anaconda3\envs\valuenet\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)

File "E:\Project\Implementation\valuenet1\valuenet\src\model\encoder\encoder.py", line 65, in forward
averaged_hidden_states_question, pointers_after_question = self._average_hidden_states_question(last_hidden_states, all_question_span_lengths)

File "E:\Project\Implementation\valuenet1\valuenet\src\model\encoder\encoder.py", line 141, in _average_hidden_states_question
averaged_span = torch.mean(last_hidden_states[batch_itr_idx, pointer: pointer + span_length, :],

TypeError: string indices must be integers