microsoft/rat-sql

preprocess.main(preprocess_config)

fengxing11111 opened this issue · 3 comments

the problem is as follows:
WARNING <class 'ratsql.models.enc_dec.EncDecModel.Preproc'>: superfluous {'name': 'EncDec'}
Traceback (most recent call last):
File "/home/pl/rat-sql-master/run.py", line 109, in
main()
File "/home/pl/rat-sql-master/run.py", line 73, in main
preprocess.main(preprocess_config)
File "/home/pl/rat-sql-master/ratsql/commands/preprocess.py", line 53, in main
preprocessor.preprocess()
File "/home/pl/rat-sql-master/ratsql/commands/preprocess.py", line 30, in preprocess
data = registry.construct('dataset', self.config['data'][section])
File "/home/pl/rat-sql-master/ratsql/utils/registry.py", line 33, in construct
lookup(kind, config),
File "/home/pl/rat-sql-master/ratsql/utils/registry.py", line 28, in lookup
return _REGISTRY[kind][name]
KeyError: 'spider'

i find the problem maybe caused by registry.py file func: signature = inspect.signature(callable)

import torch
class SpiderDataset(torch.utils.data.Dataset):
    def __init__(self, paths, tables_paths, db_path, demo_path=None, limit=None):
        pass

if __name__ == '__main__':
    import inspect
    b=inspect.signature(SpiderDataset)
    for i,j in b.parameters.items():
        print(i,j,j.kind)

print
args *args VAR_POSITIONAL
kwds **kwds VAR_KEYWORD

 i think the process want print  paths, tables_paths, db_path these arguments
i don't know how to modify it.

When I changed Docker base Image to 'pytorch/pytorch:1.7.0-cuda11.0-cudnn8-devel', It shows same issue.
Could you try to use origin Docker base image

'FROM pytorch/pytorch:1.5-cuda10.1-cudnn7-devel'

i fix the problem in registry.py in line 41 with signature = inspect.signature(callable. __init__) and the problem is solved.i test the syntax within python3.6 and python3.7 and python3.6 is ok (source code) but python3.7.9 is not.

Getting this when launch the preprocess

Traceback (most recent call last):
File "run.py", line 109, in
main()
File "run.py", line 73, in main
preprocess.main(preprocess_config)
File "/app/ratsql/commands/preprocess.py", line 51, in main
preprocessor = Preprocessor(config)
File "/app/ratsql/commands/preprocess.py", line 24, in init
self.model_preproc = registry.instantiate(registry.lookup('model', config['model']).Preproc,config['model'])
File "/app/ratsql/utils/registry.py", line 57, in instantiate
return callable(**merged)
File "/app/ratsql/models/enc_dec.py", line 32, in init
self.enc_preproc = registry.lookup('encoder', encoder['name']).Preproc(**encoder_preproc)
File "/app/ratsql/models/spider/spider_enc.py", line 146, in init
self.word_emb = registry.construct('word_emb', word_emb)
File "/app/ratsql/utils/registry.py", line 36, in construct
**kwargs)
File "/app/ratsql/utils/registry.py", line 57, in instantiate
return callable(**merged)
File "/app/ratsql/resources/pretrained_embeddings.py", line 49, in init
self.glove = torchtext.vocab.GloVe(name=kind, cache=cache)
File "/root/.local/lib/python3.7/site-packages/torchtext/vocab.py", line 401, in init
super(GloVe, self).init(name, url=url, **kwargs)
File "/root/.local/lib/python3.7/site-packages/torchtext/vocab.py", line 280, in init
self.cache(name, cache, url=url, max_vectors=max_vectors)
File "/root/.local/lib/python3.7/site-packages/torchtext/vocab.py", line 320, in cache
with zipfile.ZipFile(dest, "r") as zf:
File "/opt/conda/lib/python3.7/zipfile.py", line 1258, in init
self._RealGetContents()
File "/opt/conda/lib/python3.7/zipfile.py", line 1325, in _RealGetContents
raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file