neulab / external-knowledge-codegen

Code and data for ACL20 paper "Incorporating External Knowledge through Pre-training for Natural Language to Code Generation"
Apache License 2.0
95 stars 14 forks source link

ModuleNotFoundError: No module named 'asdl' #2

Open talk2kabir opened 3 years ago

talk2kabir commented 3 years ago

Hello, Please I am trying to preprocess the data to obtain the .bin file that will enable me train the data. Unfortunately, the following error keep appearing. (base) lab@master:~/external-knowledge-codegen$ python datasets/conala/dataset.py --pretrain data/conala/conala-mined.jsonl --topk 100000 --include_api apidocs/processed/distsmpl/snippet_15k/goldmine_snippet_count100k_topk1_temp2.jsonl Traceback (most recent call last): File "datasets/conala/dataset.py", line 9, in from asdl.hypothesis import * ModuleNotFoundError: No module named 'asdl'

I tried to install asdl library and the error changed to "ModuleNotFoundError: No module named 'asdl.hypothesis'; 'asdl' is not a package"

I will appreciate any help from you to enable me run the model successfully. Thank you.

codewithdongjy commented 2 years ago

I also encountered this problem, may I ask how you finally solved it? Thanks!

KevinHuuu commented 2 years ago

I also encountered this problem, but solved by adding this repo to the PYTHONPATH

First one should uninstall the pip asdl package by doing

pip uninstall asdl

and then add PYTHONPATH (the repo contains local built asdl)

export PYTHONPATH=/home/ubuntu/external-knowledge-codegen:path

but I also get the following error after the above procudure

from file:  data/conala/conala-mined.jsonl
Traceback (most recent call last):
  File "datasets/conala/dataset.py", line 225, in <module>
    out_dir=args.out_dir)
  File "datasets/conala/dataset.py", line 44, in preprocess_conala_dataset
    firstk=num_mined)
  File "datasets/conala/dataset.py", line 118, in preprocess_dataset
    tgt_ast = python_ast_to_asdl_ast(python_ast, transition_system.grammar)
  File "/home/ubuntu/external-knowledge-codegen/asdl/lang/py/py_asdl_helper.py", line 50, in python_ast_to_asdl_ast
    child_node = python_ast_to_asdl_ast(val, grammar)
  File "/home/ubuntu/external-knowledge-codegen/asdl/lang/py/py_asdl_helper.py", line 33, in python_ast_to_asdl_ast
    production = grammar.get_prod_by_ctr_name(py_node_name)
  File "/home/ubuntu/external-knowledge-codegen/asdl/asdl.py", line 49, in get_prod_by_ctr_name
    return self._constructor_production_map[name]
KeyError: 'AnnAssign'