Closed hmhm1190 closed 1 year ago
It seems you did not download the T5 checkpoints we provided.
Ohh!! Thanks for pointing it out...
Actually is it possible to run inference script on cpu, I am having only 12 GB GPU and its showing Cuda out of memory error
(RESDSQL) [husainmalwat@localhost RESDSQL]$ sh scripts/inference/infer_text2sql.sh base spider
366it [00:22, 16.43it/s]
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████| 23/23 [00:20<00:00, 1.12it/s]
Namespace(batch_size=16, db_path='./database', dev_filepath='./data/preprocessed_data/resdsql_test.json', device='0,1', epochs=128, gradient_descent_step=4, learning_rate=3e-05, mode='eval', model_name_or_path='t5-3b', num_beams=8, num_return_sequences=8, original_dev_filepath='./data/spider/dev.json', output='./predictions/Spider-dev/resdsql_base/pred.sql', save_path='./models/text2sql-t5-base/checkpoint-39312', seed=42, tables_for_natsql='NatSQL/NatSQLv1_6/tables_for_natsql.json', target_type='sql', tensorboard_save_path='tensorboard_log/text2sql', train_filepath='data/preprocessed_data/resdsql_train_spider.json', use_adafactor=False)
0%| | 0/23 [00:00<?, ?it/s]
Traceback (most recent call last):
File "text2sql.py", line 352, in <module>
_test(opt)
File "text2sql.py", line 293, in _test
model_outputs = model.generate(
File "/home/husainmalwat/anaconda3/envs/RESDSQL/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
return func(*args, **kwargs)
File "/home/husainmalwat/anaconda3/envs/RESDSQL/lib/python3.8/site-packages/transformers/generation/utils.py", line 1524, in generate
return self.beam_search(
File "/home/husainmalwat/anaconda3/envs/RESDSQL/lib/python3.8/site-packages/transformers/generation/utils.py", line 2883, in beam_search
model_kwargs["past_key_values"] = self._reorder_cache(model_kwargs["past_key_values"], beam_idx)
File "/home/husainmalwat/anaconda3/envs/RESDSQL/lib/python3.8/site-packages/transformers/models/t5/modeling_t5.py", line 1815, in _reorder_cache
layer_past_state.index_select(0, beam_idx.to(layer_past_state.device)),
RuntimeError: CUDA out of memory. Tried to allocate 192.00 MiB (GPU 0; 10.76 GiB total capacity; 9.69 GiB already allocated; 65.12 MiB free; 9.79 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF
Maybe you can reduce the text2natsql_model_bs
in the inference script.
thanks, working now
I am also attaching the entire output log:
RESDSQL.txt