Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preporcessing issue #61

Open
Xuanfang1121 opened this issue Nov 3, 2021 · 2 comments
Open

preporcessing issue #61

Xuanfang1121 opened this issue Nov 3, 2021 · 2 comments

Comments

@Xuanfang1121
Copy link

when I run preprocessing script (python run.py preprocess experiments/spider-bert-run.jsonnet), it gives me the following error:
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 53, in main
preprocessor.preprocess()
File "/app/ratsql/commands/preprocess.py", line 30, in preprocess
data = registry.construct('dataset', self.config['data'][section])
File "/app/ratsql/utils/registry.py", line 32, in construct
return instantiate(
File "/app/ratsql/utils/registry.py", line 44, in instantiate
raise ValueError(f'Unsupported kind for param {name}: {param.kind}')
ValueError: Unsupported kind for param args: VAR_POSITIONAL

the base image ispytorch/pytorch:1.8.0-cuda11.1-cudnn8-devel in the Dockerfile. python == 3.8.8
Any suggestion?

@ReinierKoops
Copy link

I had a similar issue. This disappeared magically when I changed my version to Pytorch 1.5.1 with 10.1 cuda.

Would be interested to see if someone could update it to more recent version.

@siyue-zhang
Copy link

It is because the inspect.signature doesn't support your pytorch dataset version. A workaround could be modifying the registry.py file as following:

def instantiate(callable, config, unused_keys=(), **kwargs):
    merged = {**config, **kwargs}
    if 'dataset' in str(callable):
        signature = inspect.signature(callable.__init__)
    else:
        signature = inspect.signature(callable)
    for name, param in signature.parameters.items():
        if param.kind in (inspect.Parameter.POSITIONAL_ONLY, inspect.Parameter.VAR_POSITIONAL):
            raise ValueError(f'Unsupported kind for param {name}: {param.kind}')

    if any(param.kind == inspect.Parameter.VAR_KEYWORD for param in signature.parameters.values()):
        return callable(**merged)

    missing = {}
    for key in list(merged.keys()):
        if key not in signature.parameters:
            if key not in unused_keys:
                missing[key] = merged[key]
            merged.pop(key)
    if missing:
        print(f'WARNING {callable}: superfluous {missing}', file=sys.stderr)
    return callable(**merged)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants