nyu-mll / jiant

jiant is an nlp toolkit
https://jiant.info
MIT License
1.64k stars 297 forks source link

Error report about running code in edge probing example notebook. #1342

Open 24kMengXin opened 2 years ago

24kMengXin commented 2 years ago

When I run the 'jiant_EdgeProbing_Example.ipynb', it reports an error

KeyError: <TaskTypes.MULTI_LABEL_SPAN_CLASSIFICATION: 'multi_label_span_classification'>

in the train step after display

Creating Tasks: semeval (SemevalTask): ./tasks/configs/semeval_config.json

Here is the detail of traceback:

Creating Tasks: semeval (SemevalTask): ./tasks/configs/semeval_config.json Traceback (most recent call last): File "/content/anaconda3/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3437, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 1, in runfile('/content/code/test_jiant.py', wdir='/data/home/mc05413/code/mbart_probe_discourse') File "/content/.pycharm_helpers/pydev/_pydev_bundle/pydev_umd.py", line 197, in runfile pydev_imports.execfile(filename, global_vars, local_vars) # execute the script File "/content/.pycharm_helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/content/code/test_jiant.py", line 127, in main_runscript.run_loop(run_args) File "/content/code/jiant/proj/main/runscript.py", line 140, in run_loop runner = setup_runner( File "/content/code/jiant/proj/main/runscript.py", line 86, in setup_runner jiant_model = jiant_model_setup.setup_jiant_model( File "/content/code/jiant/proj/main/modeling/model_setup.py", line 59, in setup_jiant_model taskmodels_dict = { File "/content/code/jiant/proj/main/modeling/model_setup.py", line 60, in taskmodel_name: create_taskmodel( File "/content/code/jiant/proj/main/modeling/model_setup.py", line 284, in create_taskmodel head = JiantHeadFactory()(task, **head_kwargs) File "/content/jiant/proj/main/modeling/heads.py", line 69, in call head_class = self.registry[task.TASK_TYPE] KeyError: <TaskTypes.MULTI_LABEL_SPAN_CLASSIFICATION: 'multi_label_span_classification'>

I just copy the code from example notebook and change nothing (I put the .py file in a same content with jiant package).

How to solve this problem? Thank you very much.

Chang-Hongyang commented 2 years ago

I also encountered this mistake. After reading the code, I found to be in the jiant/proj/main/modeling/heads. py file lacks of the definition of the classifier, although in taskmodel. py file has corresponding model classes.

cl-trier commented 1 year ago

so how to fix this?