RUCKBReasoning / RESDSQL

The Pytorch implementation of RESDSQL (AAAI 2023).
https://arxiv.org/abs/2302.05965
MIT License
238 stars 59 forks source link

Error in Running Inference script #35

Closed hmhm1190 closed 1 year ago

hmhm1190 commented 1 year ago
 raise HFValidationError(
huggingface_hub.utils._validators.HFValidationError: Repo id must be in the form 'repo_name' or 'namespace/repo_name': './models/text2sql-t5-base/checkpoint-39312'. Use `repo_type` argument if needed.

I am also attaching the entire output log:

RESDSQL.txt

lihaoyang-ruc commented 1 year ago

It seems you did not download the T5 checkpoints we provided.

image
hmhm1190 commented 1 year ago

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
lihaoyang-ruc commented 1 year ago

Maybe you can reduce the text2natsql_model_bs in the inference script.

hmhm1190 commented 1 year ago

thanks, working now